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 /tests/auto | |
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 'tests/auto')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 82f4d16..4b6b0b7 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -250,6 +250,7 @@ private slots: void dateRoundtripQtJSQt(); void dateConversionJSQt(); void dateConversionQtJS(); + void stringListFromArrayWithEmptyElement(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -6141,5 +6142,13 @@ void tst_QScriptEngine::scriptValueFromQMetaObject() } } +// QTBUG-21896 +void tst_QScriptEngine::stringListFromArrayWithEmptyElement() +{ + QScriptEngine eng; + QCOMPARE(qscriptvalue_cast<QStringList>(eng.evaluate("[,'hello']")), + QStringList() << "" << "hello"); +} + QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" |