From c9dea0fe1551a4ef0dfac88c1284d894f4d5f42a Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Sat, 3 Nov 2018 12:41:52 -0700 Subject: [PATCH] fix crashes when zcashd is not present --- src/rpc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rpc.cpp b/src/rpc.cpp index fa205b9..562a6da 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -213,6 +213,10 @@ void RPC::sendZTransaction(json params, const std::function& cb) { * private keys */ void RPC::getAllPrivKeys(const std::function>)> cb) { + if (conn == nullptr) { + // No connection, just return + return; + } // A special function that will call the callback when two lists have been added auto holder = new QPair>>(); @@ -813,6 +817,12 @@ void RPC::refreshZECPrice() { } void RPC::shutdownZcashd() { + // Shutdown embedded zcashd if it was started + if (ezcashd == nullptr || conn == nullptr) { + // No zcashd running internally, just return + return; + } + json payload = { {"jsonrpc", "1.0"}, {"id", "someid"},