From bfb36fec895b557842a5647e045a1b71e0add66d Mon Sep 17 00:00:00 2001 From: Aziz Berkay Yesilyurt Date: Wed, 3 Nov 2021 21:51:25 +0100 Subject: [PATCH] WindowServer: Return ShareableBitmap() on fail WindowServer returns {} on non-existing screen index, however shot program hangs instead of retriving an empty ShareableBitmap. With this change, the function returns an empty ShareableBitmap and shot exits gracefully. --- Userland/Services/WindowServer/ClientConnection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index 1d2fb61776..5599c86b4c 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -968,7 +968,7 @@ Messages::WindowServer::GetScreenBitmapResponse ClientConnection::get_screen_bit auto* screen = Screen::find_by_index(screen_index.value()); if (!screen) { dbgln("get_screen_bitmap: Screen {} does not exist!", screen_index.value()); - return { {} }; + return { Gfx::ShareableBitmap() }; } if (rect.has_value()) { auto bitmap = Compositor::the().front_bitmap_for_screenshot({}, *screen).cropped(rect.value()); @@ -994,7 +994,7 @@ Messages::WindowServer::GetScreenBitmapResponse ClientConnection::get_screen_bit }); return bitmap->to_shareable_bitmap(); } - return { {} }; + return { Gfx::ShareableBitmap() }; } Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::get_screen_bitmap_around_cursor(Gfx::IntSize const& size)