From 4bb0e85cfe22a97f1fe78b953baae19e37796bd6 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Tue, 2 Feb 2010 10:47:07 +0100
Subject: [PATCH] Cleanup

---
 src/plugins/qmljseditor/qmlcodecompletion.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp
index 10dedc173d4..2d6340de713 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);
     }
-- 
GitLab