fix #348 : crash when failed to expand parametered macro in the expression

This commit is contained in:
Roy Qu 2024-03-30 12:42:48 +08:00
parent d31221ff42
commit dd1bb88733
1 changed files with 3 additions and 1 deletions

View File

@ -4615,7 +4615,7 @@ PEvalStatement CppParser::doEvalExpression(const QString& fileName,
PStatement macro = findMacro(word, fileName);
if (macro) {
if(!expandMacro(phraseExpression, i, macro, usedMacros))
continue;
return PEvalStatement();
}
}
}
@ -5362,6 +5362,8 @@ bool CppParser::expandMacro(QStringList &phraseExpression, int pos, PStatement m
phraseExpression.removeAt(pos);
usedMacros.removeAt(pos);
} else {
if (pos+1 >= phraseExpression.length() || phraseExpression[pos+1]!=")")
return false;
QString args=macro->args.mid(1,macro->args.length()-2).trimmed(); // remove '(' ')'
if(args=="")