From b2969c97fd808e229ff57949dbb9c683f3830b71 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 1 Jun 2012 21:05:31 +0200 Subject: Fix crash when converting invalid JSValue to string JSC::JSValue::toString() expects that the input is valid. Task-number: QTBUG-21896 Change-Id: I3199fcba94be5426cb3d193b57d16176daae83a0 Reviewed-by: Olivier Goffart --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index bd2b736..23ab8ef 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -247,6 +247,7 @@ private slots: void dateRoundtripQtJSQt(); void dateConversionJSQt(); void dateConversionQtJS(); + void stringListFromArrayWithEmptyElement(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -6133,5 +6134,13 @@ void tst_QScriptEngine::scriptValueFromQMetaObject() } } +// QTBUG-21896 +void tst_QScriptEngine::stringListFromArrayWithEmptyElement() +{ + QScriptEngine eng; + QCOMPARE(qscriptvalue_cast(eng.evaluate("[,'hello']")), + QStringList() << "" << "hello"); +} + QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" -- cgit v1.2.1