mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
LibWeb: Fix null dereference in HtmlView::mousedown_event
Running event handlers in response to a mouse event may cause full layout invalidation, so we can't expect the layout root to be present right after returning from JS. Fixes #1629.
This commit is contained in:
@@ -242,7 +242,8 @@ void HtmlView::mousedown_event(GUI::MouseEvent& event)
|
||||
}
|
||||
} else {
|
||||
if (event.button() == GUI::MouseButton::Left) {
|
||||
layout_root()->selection().set({ result.layout_node, result.index_in_node }, {});
|
||||
if (layout_root())
|
||||
layout_root()->selection().set({ result.layout_node, result.index_in_node }, {});
|
||||
dump_selection("MouseDown");
|
||||
m_in_mouse_selection = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user