CppEditor: Work around an endless loop

Change-Id: I9fdcead4e3770e9feec4124a0b1b8e7aa1c53b70
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2023-01-03 09:15:48 +01:00
parent 4947c5c657
commit 2e52f4d8ef

View File

@@ -175,7 +175,9 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to)
const QTextBlock lastBlockForResult = m_baseTextDocument->document()
->findBlock(endRange);
const QTextBlock endBlock = lastBlockForResult.next();
for (QTextBlock block = firstBlockForResult; block != endBlock; block = block.next()) {
for (QTextBlock block = firstBlockForResult;
block.isValid() && block != endBlock;
block = block.next()) {
Parentheses syntacticParens = getClearedParentheses(block);
// Remove mis-detected parentheses inserted by syntactic highlighter.