Skip to content

Commit

Permalink
Avoid a segfault on getblock if it can't read a block from disk.
Browse files Browse the repository at this point in the history
Rebased-From: 954d2e7
  • Loading branch information
rdponticelli authored and Ross Nicoll committed Aug 29, 2014
1 parent d6a5e74 commit 32f359f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rpcblockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ Value getblock(const Array& params, bool fHelp)

CBlock block;
CBlockIndex* pblockindex = mapBlockIndex[hash];
ReadBlockFromDisk(block, pblockindex);

if(!ReadBlockFromDisk(block, pblockindex))
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");

if (!fVerbose)
{
Expand Down

0 comments on commit 32f359f

Please sign in to comment.