File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,8 @@ class CDataStream
248248
249249 void insert (iterator it, std::vector<char >::const_iterator first, std::vector<char >::const_iterator last)
250250 {
251- assert (last - first >= 0 );
251+ if (last == first) return ;
252+ assert (last - first > 0 );
252253 if (it == vch.begin () + nReadPos && (unsigned int )(last - first) <= nReadPos)
253254 {
254255 // special case for inserting at the front when there's room
@@ -261,7 +262,8 @@ class CDataStream
261262
262263 void insert (iterator it, const char * first, const char * last)
263264 {
264- assert (last - first >= 0 );
265+ if (last == first) return ;
266+ assert (last - first > 0 );
265267 if (it == vch.begin () + nReadPos && (unsigned int )(last - first) <= nReadPos)
266268 {
267269 // special case for inserting at the front when there's room
@@ -339,6 +341,8 @@ class CDataStream
339341
340342 void read (char * pch, size_t nSize)
341343 {
344+ if (nSize == 0 ) return ;
345+
342346 // Read from the beginning of the buffer
343347 unsigned int nReadPosNext = nReadPos + nSize;
344348 if (nReadPosNext >= vch.size ())
You can’t perform that action at this time.
0 commit comments