From 5107ba57c2a5d2f11f83cc8f03d2e4fd58fea1f4 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Tue, 26 Jan 2010 16:31:07 +0100
Subject: [PATCH] There's no need to create a namespace object when the
 importId is invalid.

---
 src/libs/qmljs/qmljsbind.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index 61863631be8..cf042d9e538 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -128,11 +128,11 @@ bool Bind::visit(UiImport *ast)
     ObjectValue *namespaceObject;
 
     if (ast->asToken.isValid()) { // with namespace we insert an object in the type env. to hold the imported types
-        namespaceObject = _interp->newObject(/*prototype */ 0);
-
         if (!ast->importId)
             return false; // this should never happen, but better be safe than sorry
 
+        namespaceObject = _interp->newObject(/*prototype */ 0);
+
         _typeEnvironment->setProperty(ast->importId->asString(), namespaceObject);
 
     } else { // without namespace we insert all types directly into the type env.
-- 
GitLab