1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

LibGUI: Fix null parent deref in AbstractButton::set_checked()

If a button is orphaned, there are no siblings anyway, so there's no
need to try to update them.
This commit is contained in:
Andreas Kling 2020-10-30 16:44:56 +01:00
parent 3f4df354cb
commit 9baa649389

View file

@ -68,7 +68,7 @@ void AbstractButton::set_checked(bool checked)
return;
m_checked = checked;
if (is_exclusive() && checked) {
if (is_exclusive() && checked && parent_widget()) {
parent_widget()->for_each_child_of_type<AbstractButton>([&](auto& sibling) {
if (!sibling.is_exclusive() || !sibling.is_checked())
return IterationDecision::Continue;