diff options
-rw-r--r-- | src/corelib/tools/qstring.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qstringref/tst_qstringref.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index f60ab0aef3..a46ff1e881 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -11047,8 +11047,6 @@ QStringRef QStringRef::trimmed() const QStringAlgorithms<const QStringRef>::trimmed_helper_positions(begin, end); if (begin == cbegin() && end == cend()) return *this; - if (begin == end) - return QStringRef(); int position = m_position + (begin - cbegin()); return QStringRef(m_string, position, end - begin); } diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index d2374fe0ae..473f563f9b 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp @@ -1862,7 +1862,9 @@ void tst_QStringRef::double_conversion() void tst_QStringRef::trimmed() { - QString a; + QVERIFY(QStringRef().trimmed().isNull()); + QString a = ""; + QVERIFY(!QStringRef(&a).trimmed().isNull()); QStringRef b; a = "Text"; b = a.leftRef(-1); |