diff options
author | MeshCollider <dobsonsa68@gmail.com> | 2017-08-23 19:47:56 +1200 |
---|---|---|
committer | MeshCollider <dobsonsa68@gmail.com> | 2017-08-23 19:47:56 +1200 |
commit | c0019924406e1ce8368465c768de11019ad5eeed (patch) | |
tree | 3942cecb72ede011b95aa2bba57ab76e10da520c /src/rpc/blockchain.cpp | |
parent | 3e55f13bfc98a6b832697d1d0cfb942dbe2094db (diff) |
Fix potential null dereferences
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r-- | src/rpc/blockchain.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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<CCoinsViewCursor> 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"); |