diff options
author | Crax97 <gsolimeno97@gmail.com> | 2022-08-29 22:51:49 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-31 12:20:55 +0200 |
commit | c9fb3804909a8ea91a3e0def84120374ce538b7e (patch) | |
tree | 101f62ac7af1938f562d5b4efa8a70bb478124d5 | |
parent | 3037f5b1834ed34352a198c9de5b3273792d49f6 (diff) | |
download | serenity-c9fb3804909a8ea91a3e0def84120374ce538b7e.zip |
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
-rw-r--r-- | Userland/Applications/PixelPaint/ImageEditor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 23908092fd..aa76f0e593 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -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); |