]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix potential nullptr de-reference
authorFelix Ernst <fe.a.ernst@gmail.com>
Sun, 8 Jan 2023 14:07:16 +0000 (15:07 +0100)
committerFelix Ernst <fe.a.ernst@gmail.com>
Sun, 8 Jan 2023 14:07:16 +0000 (15:07 +0100)
The `break` that is replaced by a `return` here would only break
out of the innermost while loop so the std::vector::end could still
become accessed after that. By returning here we completely exit
out of both nested loops and therefore don't access the
std::vector::end.

src/selectionmode/backgroundcolorhelper.cpp

index 893a75ccff4b129339bf76247858255cc09cd38e..799db43d596dfe20a72f6365f55730e78bcb7d6e 100644 (file)
@@ -56,7 +56,7 @@ void BackgroundColorHelper::slotPaletteChanged()
         while (!*i) {
             i = m_colorControlledWidgets.erase(i);
             if (i == m_colorControlledWidgets.end()) {
-                break;
+                return;
             }
         }
         setBackgroundColorForWidget(*i, m_backgroundColor);