diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 1fae9ef07af..66838a2ec43 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -2482,11 +2482,8 @@ QString::QString(const QChar *unicode, qsizetype size) if (!unicode) { d.clear(); } else { - if (size < 0) { - size = 0; - while (!unicode[size].isNull()) - ++size; - } + if (size < 0) + size = QtPrivate::qustrlen(reinterpret_cast(unicode)); if (!size) { d = DataPointer::fromRawData(&_empty, 0); } else {