aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-07-23 15:10:58 +0200
committerLars Knoll <lars.knoll@digia.com>2014-07-31 09:03:00 +0200
commit2064a262bfeca56820b906d89f0255e5185f3320 (patch)
tree6b832758d32fd4c1d008d20f95197dcef4f269f6 /src
parent59d5c5cf555a51cd7559cea197a198ef3a792614 (diff)
Fix crash when throwing an exception from within a constructor
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>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 10974780f3..29628eb3ee 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -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();