From 5a79c69b0216f070b07d8238e4c2c7e3420faeec Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 20 Nov 2021 14:29:33 +0100 Subject: LibGfx: Make ImageDecoderPlugin::frame() return ErrorOr<> This is a first step towards better error propagation from image codecs. --- Userland/Libraries/LibGfx/Bitmap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Userland/Libraries/LibGfx/Bitmap.cpp') diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index 5d2c6e823b..06f2afe419 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -136,7 +136,8 @@ ErrorOr> Bitmap::try_load_from_fd_and_close(int fd, String { auto file = TRY(MappedFile::map_from_fd_and_close(fd, path)); if (auto decoder = ImageDecoder::try_create(file->bytes())) { - if (auto bitmap = decoder->frame(0).image) + auto frame = TRY(decoder->frame(0)); + if (auto& bitmap = frame.image) return bitmap.release_nonnull(); } -- cgit v1.2.3