浏览代码

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! :^)
Andreas Kling 5 年之前
父节点
当前提交
575b674081
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Libraries/LibGUI/Widget.cpp

+ 1 - 1
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();
     }