diff options
4 files changed, 12 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 5c2cda7..6666532 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -92,7 +92,7 @@ public: static void registerValueTypes(); QDeclarativeValueType *operator[](int idx) const { - if (idx >= (int)QVariant::UserType) return 0; + if (idx < 0 || idx >= (int)QVariant::UserType) return 0; else return valueTypes[idx]; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.11.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.11.errors.txt new file mode 100644 index 0000000..b94e92c --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.11.errors.txt @@ -0,0 +1 @@ +8:25:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.11.qml new file mode 100644 index 0000000..25efe28 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.11.qml @@ -0,0 +1,9 @@ +import QtQuick 1.0 + +QtObject { + id: main + property variant v: Text{ + text: "variant text" + } + property alias foo: main.v.text +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index bfc0a5f..c8f26d5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -385,6 +385,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidAlias.8") << "invalidAlias.8.qml" << "invalidAlias.8.errors.txt" << false; QTest::newRow("invalidAlias.9") << "invalidAlias.9.qml" << "invalidAlias.9.errors.txt" << false; QTest::newRow("invalidAlias.10") << "invalidAlias.10.qml" << "invalidAlias.10.errors.txt" << false; + QTest::newRow("invalidAlias.11") << "invalidAlias.11.qml" << "invalidAlias.11.errors.txt" << false; QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; |