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.
This commit is contained in:
Felix Ernst 2023-01-08 15:07:16 +01:00
parent 1ea868f2f8
commit eede574723

View 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);