From 0a483cf6774bcac0a7435bc217fd81342205d225 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Fri, 17 Apr 2020 00:46:50 +0000 Subject: [PATCH] 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 --- Servers/ProtocolServer/PSClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Servers/ProtocolServer/PSClientConnection.cpp b/Servers/ProtocolServer/PSClientConnection.cpp index b8be911f841..bf7289f1bfc 100644 --- a/Servers/ProtocolServer/PSClientConnection.cpp +++ b/Servers/ProtocolServer/PSClientConnection.cpp @@ -79,7 +79,7 @@ OwnPtr PSClientConnection::handl void PSClientConnection::did_finish_download(Badge, Download& download, bool success) { RefPtr 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();