From 8c016da93808851a736ccd400c12999a1c88bd57 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann <Thomas.Hartmann@nokia.com> Date: Fri, 9 Jul 2010 17:09:28 +0200 Subject: [PATCH] QmlDesigner.contextPane: crash fix --- src/plugins/qmldesigner/qmlcontextpane.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/qmlcontextpane.cpp b/src/plugins/qmldesigner/qmlcontextpane.cpp index b0f2dae9b59..d0fe19feeb5 100644 --- a/src/plugins/qmldesigner/qmlcontextpane.cpp +++ b/src/plugins/qmldesigner/qmlcontextpane.cpp @@ -198,11 +198,13 @@ void QmlContextPane::setProperty(const QString &propertyName, const QVariant &va QmlJSIndenter indenter; indenter.setTabSize(ts.m_tabSize); indenter.setIndentSize(ts.m_indentSize); - QTextBlock start = m_editor->editor()->document()->findBlockByLineNumber(line); - QTextBlock end = m_editor->editor()->document()->findBlockByLineNumber(line); + QTextBlock start = m_editor->editor()->document()->findBlockByNumber(line); + QTextBlock end = m_editor->editor()->document()->findBlockByNumber(line); - const int indent = indenter.indentForBottomLine(m_editor->editor()->document()->begin(), end.next(), QChar::Null); - ts.indentLine(start, indent); + if (end.isValid()) { + const int indent = indenter.indentForBottomLine(m_editor->editor()->document()->begin(), end.next(), QChar::Null); + ts.indentLine(start, indent); + } } tc.endEditBlock(); tc.setPosition(cursorPostion); -- GitLab