mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:55:06 +00:00
LibWeb: Skip decoding favicon.ico if downloaded data is empty
Some sites don't have favicon.ico, so we may get 404 response. In such cases, ResourceLoader still calls success_callback. For favicon loading, we are not checking response headers or payload size. This will ultimately fail in Gfx::ImageDecoder::try_create(). So avoid unnecessary work by returning early, if data is empty.
This commit is contained in:
parent
73fe6c541a
commit
d787775806
1 changed files with 2 additions and 0 deletions
|
@ -172,6 +172,8 @@ bool FrameLoader::load(LoadRequest& request, Type type)
|
|||
favicon_url,
|
||||
[this, favicon_url](auto data, auto&, auto) {
|
||||
dbgln_if(SPAM_DEBUG, "Favicon downloaded, {} bytes from {}", data.size(), favicon_url);
|
||||
if (data.is_empty())
|
||||
return;
|
||||
RefPtr<Gfx::Bitmap> favicon_bitmap;
|
||||
auto decoder = Gfx::ImageDecoder::try_create(data);
|
||||
if (!decoder) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue