1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Userland: Return empty if ImageDecoder client receives an invalid frame

This simplifies error checking for all the users of the ImageDecoder
client.
This commit is contained in:
Tim Ledbetter 2023-10-01 19:56:19 +01:00 committed by Andreas Kling
parent e6c1429311
commit eaa6304aab
6 changed files with 11 additions and 15 deletions

View file

@ -80,7 +80,7 @@ ErrorOr<NonnullRefPtr<Client>> Client::create(StringView image_path, StringView
if (!maybe_image.has_value())
return Error::from_string_view("Image could not be read"sv);
auto image = maybe_image->frames.take_first().bitmap.release_nonnull();
auto image = maybe_image->frames.take_first().bitmap;
// Make sure to not draw out of bounds; some servers will disconnect us for that!
if (image->width() > canvas_size.width()) {