1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

WindowsServer+LibGUI: Avoid getting color under cursor outside screen

This patch fixes a crash in ColorPicker caused by the ColorSelectOverlay
trying to request the color for a pixel outside the screen rect.
This commit is contained in:
networkException 2021-12-31 23:05:35 +01:00 committed by Andreas Kling
parent 8515d7d5ab
commit b46ea5158d
3 changed files with 9 additions and 4 deletions

View file

@ -160,9 +160,11 @@ private:
virtual void mousemove_event(GUI::MouseEvent&) override
{
auto new_col = WindowServerConnection::the().get_color_under_cursor();
if (!new_col.has_value())
return;
if (new_col == m_col)
return;
m_col = new_col;
m_col = new_col.value();
if (on_color_changed)
on_color_changed(m_col);
}