From 1a95f59ddd78a14cfba1eefcc802b4b2bed1e2a2 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 11 Sep 2024 15:30:04 +0800 Subject: [PATCH] - fix: Crash if there's no period/semicolon after variable definition with intializer. --- RedPandaIDE/parser/cppparser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index c7dbadc5..8ad50205 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -4327,6 +4327,9 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic, } mIndex=mTokenizer[mIndex]->matchIndex+1; addedVar.reset(); + //If there are multiple var define in the same line, the next token should be ',' + if (mIndex>=maxIndex || mTokenizer[mIndex]->text != ",") + return; break; default: if (isIdentChar(mTokenizer[mIndex]->text[0])) {