diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-04 13:09:25 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-04 15:35:37 (GMT) |
commit | 34329f2f7b535cb0904279203ac1c06efb958651 (patch) | |
tree | 1bc239f7a6c5a6c629b2a202cb67eefe5ea3cdb9 /src/script | |
parent | 4984b36c73fb59006a28051ea82bdca0b7aeb457 (diff) | |
download | Qt-34329f2f7b535cb0904279203ac1c06efb958651.zip Qt-34329f2f7b535cb0904279203ac1c06efb958651.tar.gz Qt-34329f2f7b535cb0904279203ac1c06efb958651.tar.bz2 |
QScript: Fix crash when converting a null value to a variant.
Fixes test tst_QScriptValue::equals(engine->newVariant(QVariant(123)) <=> engine->newArray(10))
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 47c5262..024b4d0 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1591,7 +1591,9 @@ QRegExp QScriptEnginePrivate::toRegExp(JSC::ExecState *exec, JSC::JSValue value) QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue value) { - if (isObject(value)) { + if (!value) { + return QVariant(); + } else if (isObject(value)) { if (isVariant(value)) return variantValue(value); #ifndef QT_NO_QOBJECT |