Fix freeze on mismatched parentheses

This commit is contained in:
GriffinR 2024-08-29 00:05:27 -04:00
parent 5c9a1d4140
commit c9022a9089

View file

@ -241,10 +241,11 @@ QList<Token> ParseUtil::generatePostfix(const QList<Token> &tokens) {
}
while (!operatorStack.isEmpty()) {
if (operatorStack.top().value == "(" || operatorStack.top().value == ")") {
Token token = operatorStack.pop();
if (token.value == "(" || token.value == ")") {
recordError("Mismatched parentheses detected in expression!");
} else {
output.append(operatorStack.pop());
output.append(token);
}
}