diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index 10dedc173d453146639e53b52adef5ae1b4f4444..2d6340de7132a56038bea89a93a2332275019f91 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -616,11 +616,9 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) m_completions.clear(); - SemanticInfo semanticInfo = edit->semanticInfo(); + const SemanticInfo semanticInfo = edit->semanticInfo(); const QmlJS::Snapshot snapshot = semanticInfo.snapshot; - Document::Ptr qmlDocument = semanticInfo.document; - if (qmlDocument.isNull()) - return -1; + const Document::Ptr qmlDocument = semanticInfo.document; const QFileInfo currentFileInfo(fileName); @@ -635,7 +633,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) // Set up the current scope chain. Interpreter::ObjectValue *scope = interp.globalObject(); - if (isQmlFile) { + if (isQmlFile && qmlDocument) { AST::UiObjectMember *declaringMember = semanticInfo.declaringMember(editor->position()); scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember); }