summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/GIFLoader.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-06 11:52:35 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-08 00:35:27 +0100
commit2da4cfcc80b5fcd322c5194a829b76571616e5b4 (patch)
treebe401c53feed6f52e74033c02879543ef1f9fd12 /Userland/Libraries/LibGfx/GIFLoader.cpp
parentc417820bff1b24843359800b41bcec8c8fbd5788 (diff)
downloadserenity-2da4cfcc80b5fcd322c5194a829b76571616e5b4.zip
LibGfx: Use ErrorOr<T> for Bitmap::clone()
Diffstat (limited to 'Userland/Libraries/LibGfx/GIFLoader.cpp')
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index d17202ee71..f13c25b53e 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -733,8 +733,14 @@ ImageFrameDescriptor GIFImageDecoderPlugin::frame(size_t i)
m_context->error_state = GIFLoadingContext::ErrorState::FailedToDecodeAllFrames;
}
+ auto image_or_error = m_context->frame_buffer->clone();
+ if (image_or_error.is_error()) {
+ m_context->error_state = GIFLoadingContext::ErrorState::FailedToDecodeAllFrames;
+ return {};
+ }
+
ImageFrameDescriptor frame {};
- frame.image = m_context->frame_buffer->clone();
+ frame.image = image_or_error.release_value_but_fixme_should_propagate_errors();
frame.duration = m_context->images.at(i).duration * 10;
if (frame.duration <= 10) {