summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Widget.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-12 14:06:25 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-12 14:06:25 +0200
commit575b6740816c49c8fbbfd8f63bd5bed0a0fdbb0c (patch)
tree0418c0c4a0d6ad336615ab3bc2b9781bb60d2dd2 /Libraries/LibGUI/Widget.cpp
parent9d6c85e6a60bc0ca65a79d30e166ba8482af88aa (diff)
downloadserenity-575b6740816c49c8fbbfd8f63bd5bed0a0fdbb0c.zip
LibGUI: Add missing window() null check when widget's child is removed
Before notifying our window that a child was removed, we should first check that we actually have a window! :^)
Diffstat (limited to 'Libraries/LibGUI/Widget.cpp')
-rw-r--r--Libraries/LibGUI/Widget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp
index 67be0bfd0a..666ca70ed4 100644
--- a/Libraries/LibGUI/Widget.cpp
+++ b/Libraries/LibGUI/Widget.cpp
@@ -123,7 +123,7 @@ void Widget::child_event(Core::ChildEvent& event)
else
invalidate_layout();
}
- if (event.child() && Core::is<Widget>(*event.child()))
+ if (window() && event.child() && Core::is<Widget>(*event.child()))
window()->did_remove_widget({}, Core::to<Widget>(*event.child()));
update();
}