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

AK+Everywhere: Make Base64 decoding fallible

This commit is contained in:
Ben Wiederhake 2021-10-23 15:43:59 +02:00 committed by Linus Groh
parent 3bf1f7ae87
commit cb868cfa41
11 changed files with 73 additions and 32 deletions

View file

@ -100,8 +100,10 @@ Result<NonnullRefPtr<Image>, String> Image::try_create_from_pixel_paint_json(Jso
auto bitmap_base64_encoded = layer_object.get("bitmap").as_string();
auto bitmap_data = decode_base64(bitmap_base64_encoded);
if (!bitmap_data.has_value())
return String { "Base64 decode failed"sv };
auto bitmap = try_decode_bitmap(bitmap_data);
auto bitmap = try_decode_bitmap(bitmap_data.value());
if (!bitmap)
return String { "Layer bitmap decode failed"sv };