diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index d2af9ff2abf..1f7f1f6d11f 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -134,7 +134,7 @@ static inline bool foldAndCompare(const T a, const T b) */ static inline qsizetype qFindChar(QStringView str, QChar ch, qsizetype from, Qt::CaseSensitivity cs) noexcept { - if (-from > str.size()) + if (from < -str.size()) // from < 0 && abs(from) > str.size(), avoiding overflow return -1; if (from < 0) from = qMax(from + str.size(), qsizetype(0));