mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibGfx+Fallout: Make ImageDecoder return ErrorOr
...from try_create_for_raw_bytes(). If a plugin returns `true` from sniff but then fails when calling its `create()` method, we now no longer swallow that error. Allows `image` (and other places in the system) to print a more actionable error if early image headers are invalid. (We now no longer try to find another plugin that can also handle the image.) Fixes a regression from #20063 / #19893 -- before then, we didn't do fallible work this early.
This commit is contained in:
parent
be5e7a360f
commit
2e2cae26c6
Notes:
sideshowbarker
2024-07-17 02:14:39 +09:00
Author: https://github.com/nico
Commit: 2e2cae26c6
Pull-request: https://github.com/SerenityOS/serenity/pull/23489
Reviewed-by: https://github.com/LucasChollet ✅
Reviewed-by: https://github.com/trflynn89
12 changed files with 22 additions and 22 deletions
|
@ -79,7 +79,7 @@ void ImageWidget::load_from_file(StringView path)
|
|||
|
||||
auto& mapped_file = *file_or_error.value();
|
||||
auto mime_type = Core::guess_mime_type_based_on_filename(path);
|
||||
m_image_decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(mapped_file.bytes(), mime_type);
|
||||
m_image_decoder = MUST(Gfx::ImageDecoder::try_create_for_raw_bytes(mapped_file.bytes(), mime_type));
|
||||
VERIFY(m_image_decoder);
|
||||
|
||||
auto frame = m_image_decoder->frame(0).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue