Browse Source

CDataStream::ignore Throw exception instead of assert on negative nSize.

Previously disk corruption would cause an assert instead of an exception.
0.13
Patrick Strateman 9 years ago committed by Pieter Wuille
parent
commit
4bf631e5e4
  1. 4
      src/streams.h

4
src/streams.h

@ -240,7 +240,9 @@ public: @@ -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())
{

Loading…
Cancel
Save