diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-10-23 15:43:59 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-23 19:16:40 +0100 |
commit | cb868cfa41072e08987e1c32f117483445ba197d (patch) | |
tree | 89660af33860e44523b81ef66fbf375f6533eb57 /Userland/Applications/PixelPaint | |
parent | 3bf1f7ae874918365acedc3d511b60b066b9d4aa (diff) | |
download | serenity-cb868cfa41072e08987e1c32f117483445ba197d.zip |
AK+Everywhere: Make Base64 decoding fallible
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r-- | Userland/Applications/PixelPaint/Image.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index 5439c9168e..5796472f3e 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -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 }; |