diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-28 09:43:29 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-28 12:28:42 +0100 |
commit | 5022b91b31370e2afde0426f94ff2ce6843b92e6 (patch) | |
tree | f70d7b3711268b93a401dba932b3dd0e29332383 /src | |
parent | 642133eceb98612f02253f20e81c6f66a14fbe93 (diff) |
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qmlmodels/qqmllistmodel.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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(); |