From ad7e801db9fba3a80bf7daf5f87231373a1c9b09 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 9 Feb 2018 17:18:20 +0100 Subject: [PATCH] Fix crash with anonymous clients on certificate signing request and storing sent bytes refs #5753 --- lib/remote/jsonrpcconnection.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index af7c9f219..574cb007f 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -114,10 +114,15 @@ void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message) { try { ObjectLock olock(m_Stream); + if (m_Stream->IsEof()) return; + size_t bytesSent = JsonRpc::SendMessage(m_Stream, message); - m_Endpoint->AddMessageSent(bytesSent); + + if (m_Endpoint) + m_Endpoint->AddMessageSent(bytesSent); + } catch (const std::exception& ex) { std::ostringstream info; info << "Error while sending JSON-RPC message for identity '" << m_Identity << "'";