mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
AK+Everywhere: Make Base64 decoding fallible
This commit is contained in:
committed by
Linus Groh
parent
3bf1f7ae87
commit
cb868cfa41
Notes:
sideshowbarker
2024-07-18 01:57:56 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/cb868cfa410 Pull-request: https://github.com/SerenityOS/serenity/pull/10590 Reviewed-by: https://github.com/linusg
@@ -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 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user