summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/Bitmap.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-20 14:29:33 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-21 20:22:48 +0100
commit5a79c69b0216f070b07d8238e4c2c7e3420faeec (patch)
treea88ee6dff60c34b27f383d36a4dfd3ba4b11c482 /Userland/Libraries/LibGfx/Bitmap.cpp
parentae7656072a403f69607109d941aa0c4b6274f60c (diff)
downloadserenity-5a79c69b0216f070b07d8238e4c2c7e3420faeec.zip
LibGfx: Make ImageDecoderPlugin::frame() return ErrorOr<>
This is a first step towards better error propagation from image codecs.
Diffstat (limited to 'Userland/Libraries/LibGfx/Bitmap.cpp')
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.cpp3
1 files changed, 2 insertions, 1 deletions
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<NonnullRefPtr<Bitmap>> 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();
}