diff --git a/src/streams.h b/src/streams.h index 0fc6135a6a793..a50fe4e859d77 100644 --- a/src/streams.h +++ b/src/streams.h @@ -240,7 +240,9 @@ class CDataStream 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()) {