From: Felix Ernst Date: Sun, 8 Jan 2023 14:07:16 +0000 (+0100) Subject: Fix potential nullptr de-reference X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/eede5747237ac736340b01ad5b913f479011ddff Fix potential nullptr de-reference 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. --- diff --git a/src/selectionmode/backgroundcolorhelper.cpp b/src/selectionmode/backgroundcolorhelper.cpp index 893a75ccf..799db43d5 100644 --- a/src/selectionmode/backgroundcolorhelper.cpp +++ b/src/selectionmode/backgroundcolorhelper.cpp @@ -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);