diff --git a/src/plugins/texteditor/semantichighlighter.cpp b/src/plugins/texteditor/semantichighlighter.cpp index 31033815604..fa388ac40e0 100644 --- a/src/plugins/texteditor/semantichighlighter.cpp +++ b/src/plugins/texteditor/semantichighlighter.cpp @@ -136,7 +136,7 @@ void SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd( QTextDocument *doc = highlighter->document(); const int firstBlockToClear = lastBlockNumber + 1; - if (firstBlockToClear <= doc->blockCount()) + if (firstBlockToClear >= doc->blockCount()) return; QTextBlock b = doc->findBlockByNumber(firstBlockToClear);