From c5668e578308bde6f7c78cebace46ee73280b02d Mon Sep 17 00:00:00 2001 From: Zhang TingAn Date: Tue, 20 Aug 2024 13:14:22 +0800 Subject: [PATCH] fix: [debugger] crash when fetch threads Log: as title --- src/tools/debugadapter/debugger/gdbmi/gdbmi.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tools/debugadapter/debugger/gdbmi/gdbmi.cpp b/src/tools/debugadapter/debugger/gdbmi/gdbmi.cpp index 58ae617ba..d9c2b2806 100644 --- a/src/tools/debugadapter/debugger/gdbmi/gdbmi.cpp +++ b/src/tools/debugadapter/debugger/gdbmi/gdbmi.cpp @@ -67,14 +67,16 @@ QString parseString(const QString& s, QString::const_iterator& it) { QString v; while (it != s.cend()) { - if (*it == '"') + if (*it == '"') { + ++it; break; + } if (*it == '\\') if (++it == s.cend()) break; v += *it++; } - ++it; + return v; } @@ -126,7 +128,8 @@ QVariantList parseArray(const QString& str, QString::const_iterator& it) QVariantMap parseDict(const QString& str, QString::const_iterator& it) { QVariantMap m = parseKeyVal(str, it, '}'); - ++it; + if (it < str.cend()) + ++it; return m; }