1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:55:09 +00:00

ProtocolServer: Use an empty Optional<IPC::File> to pass along "no fd"

Passing `-1` wouldn't work, as these are passed to `sendfd()'.
Fixes #4706.
This commit is contained in:
AnotherTest 2021-01-01 12:21:11 +03:30 committed by Andreas Kling
parent f2973875e3
commit 887a62582d
3 changed files with 6 additions and 6 deletions

View file

@ -57,9 +57,9 @@ RefPtr<Download> Client::start_download(const String& method, const String& url,
auto response = send_sync<Messages::ProtocolServer::StartDownload>(method, url, header_dictionary, ByteBuffer::copy(request_body));
auto download_id = response->download_id();
auto response_fd = response->response_fd().fd();
if (download_id < 0 || response_fd < 0)
if (download_id < 0 || !response->response_fd().has_value())
return nullptr;
auto response_fd = response->response_fd().value().fd();
auto download = Download::create_from_id({}, *this, download_id);
download->set_download_fd({}, response_fd);
m_downloads.set(download_id, download);