From 0b863bca305ad43b3c48287ec4e62e262c8e8849 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 20 Dec 2018 18:58:10 +0100 Subject: QML: Special case null as binding type This gives us the opportunity to map the JavaScript null to QVariant's concept of isNull(). [ChangeLog][QML] Assigning JavaScript null to incompatibly typed properties generates a compile error now, rather than a runtime error. Fixes: QTBUG-72098 Change-Id: I72fd1c30d84128c774230eaaea10455b2a0e064c Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4compileddata.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/compiler/qv4compileddata.cpp') diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index e68a563a45..9379160a65 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -745,6 +745,8 @@ QString Binding::valueAsString(const CompilationUnit *unit) const case Type_Script: case Type_String: return unit->stringAt(stringIndex); + case Type_Null: + return QStringLiteral("null"); case Type_Boolean: return value.b ? QStringLiteral("true") : QStringLiteral("false"); case Type_Number: -- cgit v1.2.3