Fix freeze on mismatched parentheses
This commit is contained in:
parent
5c9a1d4140
commit
c9022a9089
1 changed files with 3 additions and 2 deletions
|
@ -241,10 +241,11 @@ QList<Token> ParseUtil::generatePostfix(const QList<Token> &tokens) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!operatorStack.isEmpty()) {
|
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!");
|
recordError("Mismatched parentheses detected in expression!");
|
||||||
} else {
|
} else {
|
||||||
output.append(operatorStack.pop());
|
output.append(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue