mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
LibGfx: Make ImageDecoderPlugin::frame() return ErrorOr<>
This is a first step towards better error propagation from image codecs.
This commit is contained in:
parent
ae7656072a
commit
5a79c69b02
26 changed files with 101 additions and 100 deletions
|
@ -136,7 +136,8 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_fd_and_close(int fd, String
|
|||
{
|
||||
auto file = TRY(MappedFile::map_from_fd_and_close(fd, path));
|
||||
if (auto decoder = ImageDecoder::try_create(file->bytes())) {
|
||||
if (auto bitmap = decoder->frame(0).image)
|
||||
auto frame = TRY(decoder->frame(0));
|
||||
if (auto& bitmap = frame.image)
|
||||
return bitmap.release_nonnull();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue