diff options
| author | Ruben Dario Ponticelli <[email protected]> | 2014-07-09 21:37:27 -0300 |
|---|---|---|
| committer | Ruben Dario Ponticelli <[email protected]> | 2014-07-10 00:34:18 -0300 |
| commit | 954d2e7201fcea7a95c5a95be574a8c0a1f16ce1 (patch) | |
| tree | 3631bd2df1d6c4adb36399a3b29debb5851c26b1 /src/rpcblockchain.cpp | |
| parent | Merge pull request #4485 from gavinandresen/refactor_python_tests (diff) | |
| download | discoin-954d2e7201fcea7a95c5a95be574a8c0a1f16ce1.tar.xz discoin-954d2e7201fcea7a95c5a95be574a8c0a1f16ce1.zip | |
Avoid a segfault on getblock if it can't read a block from disk.
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 a67f266a1..253693e62 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) { |