summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader/FrameLoader.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
index 6db5f9b13c..1fc5755223 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -68,7 +68,9 @@ static bool build_text_document(DOM::Document& document, const ByteBuffer& data)
static bool build_image_document(DOM::Document& document, const ByteBuffer& data)
{
- auto image_decoder = Gfx::ImageDecoder::create(data.data(), data.size());
+ auto image_decoder = Gfx::ImageDecoder::try_create(data.bytes());
+ if (!image_decoder)
+ return false;
auto bitmap = image_decoder->bitmap();
if (!bitmap)
return false;
@@ -164,7 +166,11 @@ bool FrameLoader::load(const LoadRequest& request, Type type)
favicon_url,
[this, favicon_url](auto data, auto&, auto) {
dbgln("Favicon downloaded, {} bytes from {}", data.size(), favicon_url);
- auto decoder = Gfx::ImageDecoder::create(data.data(), data.size());
+ auto decoder = Gfx::ImageDecoder::try_create(data);
+ if (!decoder) {
+ dbgln("No image decoder plugin for favicon {}", favicon_url);
+ return;
+ }
auto bitmap = decoder->bitmap();
if (!bitmap) {
dbgln("Could not decode favicon {}", favicon_url);