summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptfunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/bridge/qscriptfunction.cpp')
-rw-r--r--src/script/bridge/qscriptfunction.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/script/bridge/qscriptfunction.cpp b/src/script/bridge/qscriptfunction.cpp
index fd51df1..9634ea7 100644
--- a/src/script/bridge/qscriptfunction.cpp
+++ b/src/script/bridge/qscriptfunction.cpp
@@ -59,6 +59,8 @@ JSC::JSValue FunctionWrapper::proxyCall(JSC::ExecState *, JSC::JSObject *callee,
/*calledAsConstructor=*/false, eng_p);
QScriptContext *ctx = QScriptContextPrivate::create(ctx_p);
QScriptValue result = self->data->function(ctx, self->data->engine);
+ if (!result.isValid())
+ result = QScriptValue(QScriptValue::UndefinedValue);
delete ctx;
return eng_p->scriptValueToJSCValue(result);
}
@@ -73,10 +75,12 @@ JSC::JSObject* FunctionWrapper::proxyConstruct(JSC::ExecState *, JSC::JSObject *
args, /*calledAsConstructor=*/true, eng_p);
QScriptContext *ctx = QScriptContextPrivate::create(ctx_p);
QScriptValue result = self->data->function(ctx, self->data->engine);
+ if (!result.isValid())
+ result = QScriptValue(QScriptValue::UndefinedValue);
delete ctx;
if (result.isObject())
- return static_cast<JSC::JSObject*>(JSC::asObject(eng_p->scriptValueToJSCValue(result)));
- return static_cast<JSC::JSObject*>(JSC::asObject(eng_p->scriptValueToJSCValue(object)));
+ return JSC::asObject(eng_p->scriptValueToJSCValue(result));
+ return JSC::asObject(eng_p->scriptValueToJSCValue(object));
}
FunctionWithArgWrapper::FunctionWithArgWrapper(QScriptEngine *engine, int length, const JSC::Identifier &name,