1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

LibGfx/PortableFormat: Propagate errors from decode()

This commit is contained in:
Lucas CHOLLET 2023-03-12 23:03:08 -04:00 committed by Andreas Kling
parent 7ec310384a
commit fd04b2dc9b
2 changed files with 20 additions and 34 deletions

View file

@ -93,9 +93,11 @@ IntSize PortableImageDecoderPlugin<TContext>::size()
return {};
if (m_context->state < TContext::State::Decoded) {
bool success = decode(*m_context);
if (!success)
if (decode(*m_context).is_error()) {
m_context->state = TContext::State::Error;
// FIXME: We should propagate errors
return {};
}
}
return { m_context->width, m_context->height };
@ -168,9 +170,10 @@ ErrorOr<ImageFrameDescriptor> PortableImageDecoderPlugin<TContext>::frame(size_t
return Error::from_string_literal("PortableImageDecoderPlugin: Decoding failed");
if (m_context->state < TContext::State::Decoded) {
bool success = decode(*m_context);
if (!success)
if (decode(*m_context).is_error()) {
m_context->state = TContext::State::Error;
return Error::from_string_literal("PortableImageDecoderPlugin: Decoding failed");
}
}
VERIFY(m_context->bitmap);