Browse Source

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

Previously disk corruption would cause an assert instead of an exception.
pull/4/head
Patrick Strateman 8 years ago
committed by Simon
parent
commit
e9d221e764
  1. 4
      src/streams.h

4
src/streams.h

@ -241,7 +241,9 @@ public:
CBaseDataStream& 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