From: Simon Hausmann Date: Wed, 23 Jul 2014 13:10:58 +0000 (+0200) Subject: Fix crash when throwing an exception from within a constructor X-Git-Tag: v5.3.99+beta1~226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2064a262bfeca56820b906d89f0255e5185f3320;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 1097478..29628eb 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();