Change-Id: Ie9331d233894e49cf86605819687eeef765272df
Reviewed-on: http://codereview.qt-project.org/5067
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
}
QTextDocument *doc = highlighter->document();
- QTC_ASSERT(lastBlockNumber + 1 < doc->blockCount(), return);
- QTextBlock b = doc->findBlockByNumber(lastBlockNumber + 1);
+
+ const int firstBlockToClear = lastBlockNumber + 1;
+ if (firstBlockToClear == doc->blockCount())
+ return;
+ QTC_ASSERT(firstBlockToClear < doc->blockCount(), return);
+
+ QTextBlock b = doc->findBlockByNumber(firstBlockToClear);
while (b.isValid()) {
highlighter->setExtraAdditionalFormats(b, QList<QTextLayout::FormatRange>());