diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-13 20:00:01 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-13 20:00:01 +0100 |
commit | f88fe5dc3feba0a6a3e79fbd5dcee538d5e42d95 (patch) | |
tree | 61e62410db6e0889fad7c3c4eb723073fe03ac6f /Libraries/LibGUI/Splitter.cpp | |
parent | fc562a3a9306e46f8690579e7826f5240c952ec9 (diff) | |
download | serenity-f88fe5dc3feba0a6a3e79fbd5dcee538d5e42d95.zip |
LibGUI: Don't assert when hovering spacing around single-child Splitter
Fixes #1215.
Diffstat (limited to 'Libraries/LibGUI/Splitter.cpp')
-rw-r--r-- | Libraries/LibGUI/Splitter.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Libraries/LibGUI/Splitter.cpp b/Libraries/LibGUI/Splitter.cpp index 28d6795065..6d8b935d65 100644 --- a/Libraries/LibGUI/Splitter.cpp +++ b/Libraries/LibGUI/Splitter.cpp @@ -74,7 +74,7 @@ void Splitter::leave_event(Core::Event&) } } -void Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& first, Widget*& second) +bool Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& first, Widget*& second) { int x_or_y = position.primary_offset_for_orientation(m_orientation); int fudge = layout()->spacing(); @@ -87,8 +87,7 @@ void Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& fir second = &child; return IterationDecision::Continue; }); - ASSERT(first); - ASSERT(second); + return first && second; } void Splitter::mousedown_event(MouseEvent& event) @@ -99,7 +98,8 @@ void Splitter::mousedown_event(MouseEvent& event) Widget* first { nullptr }; Widget* second { nullptr }; - get_resize_candidates_at(event.position(), first, second); + if (!get_resize_candidates_at(event.position(), first, second)) + return; m_first_resizee = first->make_weak_ptr(); m_second_resizee = second->make_weak_ptr(); @@ -128,7 +128,8 @@ void Splitter::mousemove_event(MouseEvent& event) if (!m_resizing) { Widget* first { nullptr }; Widget* second { nullptr }; - get_resize_candidates_at(event.position(), first, second); + if (!get_resize_candidates_at(event.position(), first, second)) + return; recompute_grabbable_rect(*first, *second); return; } |