Commit aa2c1cc5 authored by David Schulz's avatar David Schulz
Browse files

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,12 +4766,15 @@ void TextEditorWidgetPrivate::updateCurrentLineInScrollbar() ...@@ -4766,12 +4766,15 @@ void TextEditorWidgetPrivate::updateCurrentLineInScrollbar()
m_highlightScrollBar->removeHighlights(Constants::SCROLL_BAR_CURRENT_LINE); m_highlightScrollBar->removeHighlights(Constants::SCROLL_BAR_CURRENT_LINE);
if (m_highlightScrollBar->maximum() > 0) { if (m_highlightScrollBar->maximum() > 0) {
const QTextCursor &tc = q->textCursor(); const QTextCursor &tc = q->textCursor();
if (QTextLayout *layout = tc.block().layout()) {
const int lineNumberInBlock = const int lineNumberInBlock =
tc.block().layout()->lineForTextPosition(tc.positionInBlock()).lineNumber(); layout->lineForTextPosition(tc.positionInBlock()).lineNumber();
m_highlightScrollBar->addHighlight(Constants::SCROLL_BAR_CURRENT_LINE, m_highlightScrollBar->addHighlight(
Constants::SCROLL_BAR_CURRENT_LINE,
q->textCursor().block().firstLineNumber() + lineNumberInBlock); q->textCursor().block().firstLineNumber() + lineNumberInBlock);
} }
} }
}
} }
void TextEditorWidgetPrivate::slotUpdateBlockNotify(const QTextBlock &block) void TextEditorWidgetPrivate::slotUpdateBlockNotify(const QTextBlock &block)
......
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