mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +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
|
@ -147,7 +147,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_file(NonnullOwnPtr<Core::File>
|
|||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_bytes(ReadonlyBytes bytes, Optional<IntSize> ideal_size, Optional<ByteString> mine_type)
|
||||
{
|
||||
if (auto decoder = ImageDecoder::try_create_for_raw_bytes(bytes, mine_type)) {
|
||||
if (auto decoder = TRY(ImageDecoder::try_create_for_raw_bytes(bytes, mine_type))) {
|
||||
auto frame = TRY(decoder->frame(0, ideal_size));
|
||||
if (auto& bitmap = frame.image)
|
||||
return bitmap.release_nonnull();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue