From 60ee856adbf7af7e012c16385a84c68f43e347bd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 20 Feb 2024 11:15:10 +0100 Subject: [PATCH] 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.6 6.5 Change-Id: I423e747ae4de0708d063a6bb2befd625dbd5c591 Reviewed-by: Ivan Solovev (cherry picked from commit 05f9996bbf45fc90e49ea8c1679fa25201555860) Reviewed-by: Qt Cherry-pick Bot --- src/dbus/qdbusutil.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index 78d225109a0..6eee371305c 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -392,9 +392,6 @@ namespace QDBusUtil return isValidUniqueConnectionName(busName); const auto parts = QStringView{busName}.split(u'.'); - if (parts.size() < 1) - return false; - for (QStringView part : parts) { if (part.isEmpty()) return false;