aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmlproperty.cpp4
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp10
2 files changed, 14 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 8f6639adf5..238a0462f0 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -925,6 +925,8 @@ QQmlPropertyPrivate::signalExpression(const QQmlProperty &that)
if (!(that.type() & QQmlProperty::SignalProperty))
return nullptr;
+ if (!that.d->object)
+ return nullptr;
QQmlData *data = QQmlData::get(that.d->object);
if (!data)
return nullptr;
@@ -964,6 +966,8 @@ void QQmlPropertyPrivate::takeSignalExpression(const QQmlProperty &that,
return;
}
+ if (!that.d->object)
+ return;
QQmlData *data = QQmlData::get(that.d->object, nullptr != expr);
if (!data)
return;
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 7177089d7c..4968d4e97f 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -195,6 +195,8 @@ private slots:
void nestedQQmlPropertyMap();
void underscorePropertyChangeHandler();
+
+ void signalExpressionWithoutObject();
private:
QQmlEngine engine;
};
@@ -2263,6 +2265,14 @@ void tst_qqmlproperty::underscorePropertyChangeHandler()
QVERIFY(changeHandler.isSignalProperty());
}
+void tst_qqmlproperty::signalExpressionWithoutObject()
+{
+ QQmlProperty invalid;
+ QQmlPropertyPrivate::setSignalExpression(invalid, nullptr);
+ QQmlBoundSignalExpression *expr = QQmlPropertyPrivate::signalExpression(invalid);
+ QVERIFY(!expr);
+}
+
QTEST_MAIN(tst_qqmlproperty)
#include "tst_qqmlproperty.moc"