Commit aa2c1cc5 authored by David Schulz's avatar David Schulz

Fix crash caused by invalid text document layout.

Task-number: QTCREATORBUG-15955
Change-Id: I917bf0cc8921fe9dd40f8f58894a5c72e80441ed
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 1b62a10a
......@@ -4766,10 +4766,13 @@ void TextEditorWidgetPrivate::updateCurrentLineInScrollbar()
m_highlightScrollBar->removeHighlights(Constants::SCROLL_BAR_CURRENT_LINE);
if (m_highlightScrollBar->maximum() > 0) {
const QTextCursor &tc = q->textCursor();
const int lineNumberInBlock =
tc.block().layout()->lineForTextPosition(tc.positionInBlock()).lineNumber();
m_highlightScrollBar->addHighlight(Constants::SCROLL_BAR_CURRENT_LINE,
q->textCursor().block().firstLineNumber() + lineNumberInBlock);
if (QTextLayout *layout = tc.block().layout()) {
const int lineNumberInBlock =
layout->lineForTextPosition(tc.positionInBlock()).lineNumber();
m_highlightScrollBar->addHighlight(
Constants::SCROLL_BAR_CURRENT_LINE,
q->textCursor().block().firstLineNumber() + lineNumberInBlock);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment