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
248
248
249
249
void insert (iterator it, std::vector<char >::const_iterator first, std::vector<char >::const_iterator last)
250
250
{
251
- assert (last - first >= 0 );
251
+ if (last == first) return ;
252
+ assert (last - first > 0 );
252
253
if (it == vch.begin () + nReadPos && (unsigned int )(last - first) <= nReadPos)
253
254
{
254
255
// special case for inserting at the front when there's room
@@ -261,7 +262,8 @@ class CDataStream
261
262
262
263
void insert (iterator it, const char * first, const char * last)
263
264
{
264
- assert (last - first >= 0 );
265
+ if (last == first) return ;
266
+ assert (last - first > 0 );
265
267
if (it == vch.begin () + nReadPos && (unsigned int )(last - first) <= nReadPos)
266
268
{
267
269
// special case for inserting at the front when there's room
@@ -339,6 +341,8 @@ class CDataStream
339
341
340
342
void read (char * pch, size_t nSize)
341
343
{
344
+ if (nSize == 0 ) return ;
345
+
342
346
// Read from the beginning of the buffer
343
347
unsigned int nReadPosNext = nReadPos + nSize;
344
348
if (nReadPosNext >= vch.size ())
You can’t perform that action at this time.
0 commit comments