aboutsummaryrefslogtreecommitdiff
path: root/src/streams.h
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2016-04-24 21:59:46 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2016-04-25 14:42:07 +0200
commit4bf631e5e48cd4c14c825cdaf7a1bee81e15493d (patch)
tree308551a9970037520098890f4d2a01dde2a4822e /src/streams.h
parent4f87af6fc7580912726f9bf833c21e6e1b478e1d (diff)
CDataStream::ignore Throw exception instead of assert on negative nSize.
Previously disk corruption would cause an assert instead of an exception.
Diffstat (limited to 'src/streams.h')
-rw-r--r--src/streams.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/streams.h b/src/streams.h
index 0fc6135a6a..a50fe4e859 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -240,7 +240,9 @@ public:
CDataStream& ignore(int nSize)
{
// Ignore from the beginning of the buffer
- assert(nSize >= 0);
+ if (nSize < 0) {
+ throw std::ios_base::failure("CDataStream::ignore(): nSize negative");
+ }
unsigned int nReadPosNext = nReadPos + nSize;
if (nReadPosNext >= vch.size())
{