mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:28:13 +00:00
LibWeb: Fix null dereference in ResourceClient::set_resource()
If resource_did_load() results in the ResourceClient being destroyed, we can't dereference the weak ResourceClient right after.
This commit is contained in:
parent
68d0f30368
commit
b02402e116
1 changed files with 6 additions and 2 deletions
|
@ -176,12 +176,16 @@ void ResourceClient::set_resource(Resource* resource)
|
|||
return;
|
||||
|
||||
// Make sure that reused resources also have their load callback fired.
|
||||
if (weak_this->m_resource->is_loaded())
|
||||
if (weak_this->m_resource->is_loaded()) {
|
||||
weak_this->resource_did_load();
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure that reused resources also have their fail callback fired.
|
||||
if (weak_this->m_resource->is_failed())
|
||||
if (weak_this->m_resource->is_failed()) {
|
||||
weak_this->resource_did_fail();
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue