aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/evaluatorscriptclass.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-06-21 10:53:39 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-06-26 10:55:07 +0000
commitc87299f5d0c406b1ee804760c4336f7963ecd344 (patch)
tree20581cf25731b5024083d559855c9a4032f21e41 /src/lib/corelib/language/evaluatorscriptclass.cpp
parent68911d57b06eede061ad173df43322998c4a8d45 (diff)
Do not crash on invalid property assignment in Export item
The crash would happen when creating the export information for a product whose Export item contained an assignment of the form "x.y: original", where x is not a module and the assignment was inside a Properties item. Task-number: QBS-1362 Change-Id: I900857fcd97852360ec2b75de1b7a791fd948dc4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/language/evaluatorscriptclass.cpp')
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index 18d7fd83f..6db308a7f 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -184,6 +184,18 @@ private:
result.second = false;
return result;
}
+
+ // TODO: Provide a dedicated item type for not-yet-instantiated things that
+ // look like module instances in the AST visitor.
+ if (item->type() == ItemType::ModuleInstance
+ && !item->hasProperty(StringConstants::presentProperty())) {
+ const QString errorMessage = Tr::tr("Trying to assign property '%1' "
+ "on something that is not a module.").arg(propertyName->toString());
+ extraScope = engine->currentContext()->throwError(errorMessage);
+ result.second = false;
+ return result;
+ }
+
while (item->type() == ItemType::ModuleInstance)
item = item->prototype();
if (item->type() != ItemType::Module && item->type() != ItemType::Export) {