diff options
author | Ruben Dario Ponticelli <rdponticelli@gmail.com> | 2014-07-09 21:37:27 -0300 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-08-18 15:34:28 +0200 |
commit | 44d8e093caf633c2a307e917a1096bf7c7cf867e (patch) | |
tree | 445f1ee63f0a2ed486d30ad49cc31f84ce36de92 /src | |
parent | bf75a3d3fdae069ff6eed410bf16ee68452ea41f (diff) |
Avoid a segfault on getblock if it can't read a block from disk.
Rebased-From: 954d2e7
Diffstat (limited to 'src')
-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 a303b5d3ef..aa1ef14a78 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) { |