From 5022b91b31370e2afde0426f94ff2ce6843b92e6 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 28 Jan 2021 09:43:29 +0100 Subject: QQmlListModel: Don't discern between empty and null strings If we store an empty, rather than null, string, the retrieval mechanism crashes when getting it out again. Therefore, always store a null string. Change-Id: I799293845dd2a72c04cbef3ed1dda68ea782e191 Reviewed-by: Fabian Kosmale --- src/qmlmodels/qqmllistmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp index 63587848a0..65182af3d2 100644 --- a/src/qmlmodels/qqmllistmodel.cpp +++ b/src/qmlmodels/qqmllistmodel.cpp @@ -281,6 +281,8 @@ StringOrTranslation::~StringOrTranslation() void StringOrTranslation::setString(const QString &s) { clear(); + if (s.isEmpty()) + return; QString mutableString(s); QString::DataPointer dataPointer = mutableString.data_ptr(); arrayData = dataPointer->d_ptr(); -- cgit v1.2.3