diff options
| author | Ruben Dario Ponticelli <[email protected]> | 2014-07-09 21:37:27 -0300 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2014-08-29 19:01:11 +0100 |
| commit | 32f359f3c1c46bc639682f3fcf27d0d574083bc4 (patch) | |
| tree | 594244e7b442d3f85f3b8596244a12e3fad6d4e9 /src/rpcblockchain.cpp | |
| parent | Merge pull request #664 from rnicoll/1.8.1-dev-protocol (diff) | |
| download | discoin-32f359f3c1c46bc639682f3fcf27d0d574083bc4.tar.xz discoin-32f359f3c1c46bc639682f3fcf27d0d574083bc4.zip | |
Avoid a segfault on getblock if it can't read a block from disk.
Rebased-From: 954d2e7
Diffstat (limited to 'src/rpcblockchain.cpp')
| -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 59c72e539..29b7bc689 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -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) { |