Fix crash when throwing an exception from within a constructor
authorSimon Hausmann <simon.hausmann@digia.com>
Wed, 23 Jul 2014 13:10:58 +0000 (15:10 +0200)
committerLars Knoll <lars.knoll@digia.com>
Thu, 31 Jul 2014 07:03:00 +0000 (09:03 +0200)
We need to check for the exception before doing anything with the returned
value.

Change-Id: I0086be96b2df2434b95187489d7430ae67f561a1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/jsruntime/qv4functionobject.cpp

index 1097478..29628eb 100644 (file)
@@ -386,6 +386,9 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
     if (f->function()->compiledFunction->hasQmlDependencies())
         QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
 
+    if (v4->hasException)
+        return Encode::undefined();
+
     if (result->isObject())
         return result.asReturnedValue();
     return obj.asReturnedValue();