QDBusUtil::isValidBusName(): remove an impossible condition guard

QStringView::split() only returns an empty container if a) the haystack
is empty and b) SkipEmptyParts is in effect.

Neither is the case here: We use the implicit default of KeepEmptyParts,
and we've already checked that the haystack isn't empty in the first
line of the function.

So the result of split() can never be empty here. Remove the check to
avoid confusing more readers than just yours truly.

Amends the start of the public history.

Pick-to: 6.5
Change-Id: I423e747ae4de0708d063a6bb2befd625dbd5c591
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 05f9996bbf45fc90e49ea8c1679fa25201555860)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 60ee856adbf7af7e012c16385a84c68f43e347bd)
This commit is contained in:
Marc Mutz 2024-02-20 11:15:10 +01:00 committed by Qt Cherry-pick Bot
parent 87d075f7be
commit c9ca781b25

View File

@ -392,9 +392,6 @@ namespace QDBusUtil
return isValidUniqueConnectionName(busName); return isValidUniqueConnectionName(busName);
const auto parts = QStringView{busName}.split(u'.'); const auto parts = QStringView{busName}.split(u'.');
if (parts.size() < 1)
return false;
for (QStringView part : parts) { for (QStringView part : parts) {
if (part.isEmpty()) if (part.isEmpty())
return false; return false;