diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-06-01 19:05:31 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-03 09:44:10 (GMT) |
commit | c7d269eab57982517d6fcebea051ad3d8ec955a3 (patch) | |
tree | a7d2cd3e5c2dcb504a3f7d6deef36c7f994addc3 /src | |
parent | c642dfce4066b6af80e344a60917598ad053a411 (diff) | |
download | Qt-c7d269eab57982517d6fcebea051ad3d8ec955a3.zip Qt-c7d269eab57982517d6fcebea051ad3d8ec955a3.tar.gz Qt-c7d269eab57982517d6fcebea051ad3d8ec955a3.tar.bz2 |
Fix crash when converting invalid JSValue to string
JSC::JSValue::toString() expects that the input is valid.
Cherry-picked from qt5/qtscript commit
b2969c97fd808e229ff57949dbb9c683f3830b71
Task-number: QTBUG-21896
Change-Id: I534642154ffa4ae400a2ab8e5ce1f0c35899ae6e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/qscriptengine_p.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index e3aad57..6a023d7 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -1019,6 +1019,8 @@ inline quint16 QScriptEnginePrivate::toUInt16(JSC::ExecState *exec, JSC::JSValue inline JSC::UString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JSValue value) { + if (!value) + return JSC::UString(); JSC::JSValue savedException; saveException(exec, &savedException); JSC::UString str = value.toString(exec); |