Commit cb75dd05 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Prevent endless loop when no matching brace is found

Would show up when typing ")," where the closing brace doesn't have a
matching opening brace, for example.

Done with Roberto Raggi.
parent a0fa3832
......@@ -265,9 +265,14 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor)
break;
else if (tk.is(T_LPAREN))
return startPosition + tk.position();
else if (tk.is(T_RPAREN))
index = startOfMatchingBrace(tokens, index);
else
else if (tk.is(T_RPAREN)) {
int matchingBrace = startOfMatchingBrace(tokens, index);
if (matchingBrace == index) // If no matching brace found
return -1;
index = matchingBrace;
} else
--index;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment