forked from qt-creator/qt-creator
		
	SemanticHighlighter: Fix off-by-one in assert.
Change-Id: Ie9331d233894e49cf86605819687eeef765272df Reviewed-on: http://codereview.qt-project.org/5067 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
		@@ -125,8 +125,13 @@ void TextEditor::SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd(
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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>());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user