diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-11-04 10:18:41 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-11-04 20:06:38 +0100 |
commit | 43c964b8ada63942b5d239f60fdbca6f5773f678 (patch) | |
tree | e01307e14a2b3d67b2bed4d4d0218438a1a33b3f /src/corelib | |
parent | 06456873fceddcd340431fc5999c50ff6d3c2371 (diff) |
Fix converting a null QStringRef to QString
The assumption when calling QStringRef::toString() on a null
QStringRef (i.e. when QStringRef::isNull() is true) is that
QStringRef::toString().isNull() will also return true. With the
current implementation we return a null QString() only when the
QStringRef references a nullptr QString. We need to do the same
also when QStringRef references a QString with null private data.
Change-Id: I4177a5ea187ae758d7c46fe76a9d0583140e90cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/qstring.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 51aa0b7512..edce0ff720 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -10506,7 +10506,7 @@ ownership of it, no memory is freed when instances are destroyed. */ QString QStringRef::toString() const { - if (!m_string) + if (isNull()) return QString(); if (m_size && m_position == 0 && m_size == m_string->size()) return *m_string; |