diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-11 04:56:51 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-11 05:02:15 +0200 |
commit | f0fc81a0832a8fa93c5d7e619e25f739d72b49f3 (patch) | |
tree | 7b7dbf139dbbf58e1a813cf1f357eb718308fdfd | |
parent | f2286a69a98df5d26cf2692ff33e487feafad5ab (diff) | |
parent | 954d2e7201fcea7a95c5a95be574a8c0a1f16ce1 (diff) |
Merge pull request #4501
954d2e7 Avoid a segfault on getblock if it can't read a block from disk. (Ruben Dario Ponticelli)
-rw-r--r-- | src/rpcblockchain.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a67f266a13..253693e624 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -276,7 +276,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) { |