]> Git Repo - VerusCoin.git/commitdiff
CDataStream::ignore Throw exception instead of assert on negative nSize.
authorPatrick Strateman <[email protected]>
Mon, 25 Apr 2016 04:59:46 +0000 (21:59 -0700)
committerSimon <[email protected]>
Fri, 21 Oct 2016 05:59:50 +0000 (22:59 -0700)
Previously disk corruption would cause an assert instead of an exception.

src/streams.h

index fdba4622f7d8dce45d0a65eea4e08277328e0833..9b678b3c0314d6f3e7578b48ae4dc02a3e635d92 100644 (file)
@@ -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())
         {
This page took 0.028652 seconds and 4 git commands to generate.