diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 1778edad4635a6a1b346b555acb7d578177d8851..c6051526c679667f0affa4c58efde5a6afbd400f 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -1995,10 +1995,15 @@ static void qDumpQString(QDumper &d) { const QString &str = *reinterpret_cast<const QString *>(d.data); - if (!str.isEmpty()) { - qCheckAccess(str.unicode()); - if (!str.unicode()[str.size()].isNull()) // must be '\0' terminated - qCheckAccess(0); + const int size = str.size(); + if (size < 0) + return; + if (size) { + const QChar *unicode = str.unicode(); + qCheckAccess(unicode); + qCheckAccess(unicode + size); + if (!unicode[size].isNull()) // must be '\0' terminated + return; } P(d, "value", str);