mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +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:
parent
e6c1429311
commit
eaa6304aab
6 changed files with 11 additions and 15 deletions
|
@ -66,10 +66,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Image::decode_bitmap(ReadonlyBytes bitmap_da
|
|||
if (decoded_image.frames.is_empty())
|
||||
return Error::from_string_literal("Image decode failed (no frames)");
|
||||
|
||||
auto decoded_bitmap = decoded_image.frames.first().bitmap;
|
||||
if (decoded_bitmap.is_null())
|
||||
return Error::from_string_literal("Image decode failed (no bitmap for frame)");
|
||||
return decoded_bitmap.release_nonnull();
|
||||
return decoded_image.frames.first().bitmap;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Image>> Image::create_from_bitmap(NonnullRefPtr<Gfx::Bitmap> const& bitmap)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue