diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index a1ad120520f..163fd9cb5f3 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -3229,8 +3229,10 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) ba.clear(); quint32 len; in >> len; - if (len == 0xffffffff) + if (len == 0xffffffff) { // null byte-array + ba = QByteArray(); return in; + } const quint32 Step = 1024 * 1024; quint32 allocated = 0; diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index b16680055d0..9d44e7a478a 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -10432,7 +10432,7 @@ QDataStream &operator>>(QDataStream &in, QString &str) quint32 bytes = 0; in >> bytes; // read size of string if (bytes == 0xffffffff) { // null string - str.clear(); + str = QString(); } else if (bytes > 0) { // not empty if (bytes & 0x1) { str.clear();