forked from qt-creator/qt-creator
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.
This commit is contained in:
@@ -265,9 +265,14 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor)
|
|||||||
break;
|
break;
|
||||||
else if (tk.is(T_LPAREN))
|
else if (tk.is(T_LPAREN))
|
||||||
return startPosition + tk.position();
|
return startPosition + tk.position();
|
||||||
else if (tk.is(T_RPAREN))
|
else if (tk.is(T_RPAREN)) {
|
||||||
index = startOfMatchingBrace(tokens, index);
|
int matchingBrace = startOfMatchingBrace(tokens, index);
|
||||||
else
|
|
||||||
|
if (matchingBrace == index) // If no matching brace found
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
index = matchingBrace;
|
||||||
|
} else
|
||||||
--index;
|
--index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user