LibProtocol: Don't assume request creation will succeed across IPC
Allow it to fail, and return null if it does. Fixes frequent crashes in unfavourable network conditions.
This commit is contained in:
parent
f6b86096a5
commit
25eb903a8f
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/25eb903a8f Pull-request: https://github.com/SerenityOS/serenity/pull/22689
1 changed files with 4 additions and 1 deletions
|
@ -29,7 +29,10 @@ RefPtr<Request> RequestClient::start_request(ByteString const& method, URL const
|
|||
if (body_result.is_error())
|
||||
return nullptr;
|
||||
|
||||
auto response = IPCProxy::start_request(method, url, headers_or_error.release_value(), body_result.release_value(), proxy_data);
|
||||
auto maybe_response = IPCProxy::try_start_request(method, url, headers_or_error.release_value(), body_result.release_value(), proxy_data);
|
||||
if (maybe_response.is_error())
|
||||
return nullptr;
|
||||
auto response = maybe_response.release_value();
|
||||
auto request_id = response.request_id();
|
||||
if (request_id < 0 || !response.response_fd().has_value())
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue