Skip to content

Commit f0fc81a

Browse files
committed
Merge pull request #4501
954d2e7 Avoid a segfault on getblock if it can't read a block from disk. (Ruben Dario Ponticelli)
2 parents f2286a6 + 954d2e7 commit f0fc81a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/rpcblockchain.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ Value getblock(const Array& params, bool fHelp)
276276

277277
CBlock block;
278278
CBlockIndex* pblockindex = mapBlockIndex[hash];
279-
ReadBlockFromDisk(block, pblockindex);
279+
280+
if(!ReadBlockFromDisk(block, pblockindex))
281+
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
280282

281283
if (!fVerbose)
282284
{

0 commit comments

Comments
 (0)