mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-12 05:31:14 +00:00
CDataStream::ignore Throw exception instead of assert on negative nSize.
Previously disk corruption would cause an assert instead of an exception.
This commit is contained in:
parent
4f87af6fc7
commit
4bf631e5e4
@ -240,7 +240,9 @@ public:
|
|||||||
CDataStream& ignore(int nSize)
|
CDataStream& ignore(int nSize)
|
||||||
{
|
{
|
||||||
// Ignore from the beginning of the buffer
|
// 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;
|
unsigned int nReadPosNext = nReadPos + nSize;
|
||||||
if (nReadPosNext >= vch.size())
|
if (nReadPosNext >= vch.size())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user