diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-14 18:49:12 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-14 18:49:12 +0100 |
commit | 49f273c4ca9b034547a401967fdbb2e54cc799d6 (patch) | |
tree | 988fefc0167f173146e2be91f78ce6dfa10a8953 | |
parent | b7ad35d0403d9853baf9ca7a8ba3a22a06bdaebf (diff) | |
download | serenity-49f273c4ca9b034547a401967fdbb2e54cc799d6.zip |
WindowServer: Fix crash when initiating resize from a window edge.
-rw-r--r-- | WindowServer/WSWindowManager.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp index 713f3b42da..c2ac81e020 100644 --- a/WindowServer/WSWindowManager.cpp +++ b/WindowServer/WSWindowManager.cpp @@ -630,10 +630,8 @@ void WSWindowManager::start_window_resize(WSWindow& window, WSMouseEvent& event) ASSERT(outer_rect.contains(event.position())); int window_relative_x = event.x() - outer_rect.x(); int window_relative_y = event.y() - outer_rect.y(); - int hot_area_row = window_relative_y / (outer_rect.height() / 3); - int hot_area_column = window_relative_x / (outer_rect.width() / 3); - ASSERT(hot_area_row >= 0 && hot_area_row <= 2); - ASSERT(hot_area_column >= 0 && hot_area_column <= 2); + int hot_area_row = min(2, window_relative_y / (outer_rect.height() / 3)); + int hot_area_column = min(2, window_relative_x / (outer_rect.width() / 3)); m_resize_direction = direction_for_hot_area[hot_area_row][hot_area_column]; if (m_resize_direction == ResizeDirection::None) { ASSERT(!m_resize_window); |