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
Notes: sideshowbarker 2024-07-18 01:57:56 +09:00
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 };