ProtocolServer: did_finish_download: Do not create 0 byte shared buffer

`PSClientConnection::did_finish_download()` no longer tries to create
a zero byte shared buffer when `download.payload().data()` is zero
bytes in length.

Fixes #1821
This commit is contained in:
Brendan Coles 2020-04-17 00:46:50 +00:00 committed by Andreas Kling
parent d5fb916bf0
commit 0a483cf677
Notes: sideshowbarker 2024-07-19 07:32:18 +09:00

View file

@ -79,7 +79,7 @@ OwnPtr<Messages::ProtocolServer::StopDownloadResponse> PSClientConnection::handl
void PSClientConnection::did_finish_download(Badge<Download>, Download& download, bool success)
{
RefPtr<SharedBuffer> buffer;
if (success && !download.payload().is_null()) {
if (success && download.payload().size() > 0 && !download.payload().is_null()) {
buffer = SharedBuffer::create_with_size(download.payload().size());
memcpy(buffer->data(), download.payload().data(), download.payload().size());
buffer->seal();