1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

PixelPaint: Execute mousemove_event early return check before

This is done to allow querying the current active tool inside the
event_with_pan_and_scale_applied and event_adjusted_for_layer
functions without risking a null pointer dereference
This commit is contained in:
Crax97 2022-08-29 22:51:49 +02:00 committed by Andreas Kling
parent 3037f5b183
commit c9fb380490

View file

@ -335,14 +335,14 @@ void ImageEditor::mousemove_event(GUI::MouseEvent& event)
return;
}
if (!m_active_tool)
return;
auto image_event = event_with_pan_and_scale_applied(event);
if (on_image_mouse_position_change) {
on_image_mouse_position_change(image_event.position());
}
if (!m_active_tool)
return;
auto layer_event = m_active_layer ? event_adjusted_for_layer(event, *m_active_layer) : event;
Tool::MouseEvent tool_event(Tool::MouseEvent::Action::MouseDown, layer_event, image_event, event);
m_active_tool->on_mousemove(m_active_layer.ptr(), tool_event);