mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 15:32:22 +00:00
ProtocolServer: Don't crash on failed request
The CNetworkJob::on_finish hook will be invoked both for success and failure, but there will only be a m_job->response() in the success case so we have to null-check it before using it. This should have been obvious from the "->"
This commit is contained in:
parent
b09ac26311
commit
4104f53a94
Notes:
sideshowbarker
2024-07-19 11:01:32 +09:00
Author: https://github.com/awesomekling
Commit: 4104f53a94
1 changed files with 2 additions and 1 deletions
|
@ -7,7 +7,8 @@ HttpDownload::HttpDownload(PSClientConnection& client, NonnullRefPtr<CHttpJob>&&
|
||||||
, m_job(job)
|
, m_job(job)
|
||||||
{
|
{
|
||||||
m_job->on_finish = [this](bool success) {
|
m_job->on_finish = [this](bool success) {
|
||||||
set_payload(m_job->response()->payload());
|
if (m_job->response())
|
||||||
|
set_payload(m_job->response()->payload());
|
||||||
did_finish(success);
|
did_finish(success);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue