From c0019924406e1ce8368465c768de11019ad5eeed Mon Sep 17 00:00:00 2001 From: MeshCollider Date: Wed, 23 Aug 2017 19:47:56 +1200 Subject: Fix potential null dereferences --- src/rpc/blockchain.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rpc/blockchain.cpp') diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 34f553f3b0..bcb1792646 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -812,6 +812,7 @@ static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash, static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) { std::unique_ptr pcursor(view->Cursor()); + assert(pcursor); CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); stats.hashBlock = pcursor->GetBestBlock(); @@ -1514,6 +1515,8 @@ UniValue getchaintxstats(const JSONRPCRequest& request) pindex = chainActive.Tip(); } } + + assert(pindex != nullptr); if (blockcount < 1 || blockcount >= pindex->nHeight) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block count: should be between 1 and the block's height"); -- cgit v1.2.3