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:
parent
7ec310384a
commit
fd04b2dc9b
2 changed files with 20 additions and 34 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue