summaryrefslogtreecommitdiff
path: root/Userland/Services/ImageDecoder/ClientConnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Services/ImageDecoder/ClientConnection.cpp')
-rw-r--r--Userland/Services/ImageDecoder/ClientConnection.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Services/ImageDecoder/ClientConnection.cpp b/Userland/Services/ImageDecoder/ClientConnection.cpp
index 08f75b930b..d47c4d46e9 100644
--- a/Userland/Services/ImageDecoder/ClientConnection.cpp
+++ b/Userland/Services/ImageDecoder/ClientConnection.cpp
@@ -37,7 +37,12 @@ Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::decode_image
return nullptr;
}
- auto decoder = Gfx::ImageDecoder::create(encoded_buffer.data<u8>(), encoded_buffer.size());
+ auto decoder = Gfx::ImageDecoder::try_create(ReadonlyBytes { encoded_buffer.data<u8>(), encoded_buffer.size() });
+
+ if (!decoder) {
+ dbgln_if(IMAGE_DECODER_DEBUG, "Could not find suitable image decoder plugin for data");
+ return { false, 0, Vector<Gfx::ShareableBitmap> {}, Vector<u32> {} };
+ }
if (!decoder->frame_count()) {
dbgln_if(IMAGE_DECODER_DEBUG, "Could not decode image from encoded data");