mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Merge #10250: Fix some empty vector references
f478d98
Fix some empty vector references (Pieter Wuille)
Tree-SHA512: a22022b9060cd39f8d349e8dd24490614c0028eae2fbc7186d0d26b1d47529049b2daee41f093c0722130274a0b6f7f8671c2295c8cb4a97028771eaff080734
This commit is contained in:
commit
1428f3030d
@ -248,7 +248,8 @@ public:
|
|||||||
|
|
||||||
void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
|
void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
|
||||||
{
|
{
|
||||||
assert(last - first >= 0);
|
if (last == first) return;
|
||||||
|
assert(last - first > 0);
|
||||||
if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
|
if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
|
||||||
{
|
{
|
||||||
// special case for inserting at the front when there's room
|
// special case for inserting at the front when there's room
|
||||||
@ -261,7 +262,8 @@ public:
|
|||||||
|
|
||||||
void insert(iterator it, const char* first, const char* last)
|
void insert(iterator it, const char* first, const char* last)
|
||||||
{
|
{
|
||||||
assert(last - first >= 0);
|
if (last == first) return;
|
||||||
|
assert(last - first > 0);
|
||||||
if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
|
if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
|
||||||
{
|
{
|
||||||
// special case for inserting at the front when there's room
|
// special case for inserting at the front when there's room
|
||||||
@ -339,6 +341,8 @@ public:
|
|||||||
|
|
||||||
void read(char* pch, size_t nSize)
|
void read(char* pch, size_t nSize)
|
||||||
{
|
{
|
||||||
|
if (nSize == 0) return;
|
||||||
|
|
||||||
// Read from the beginning of the buffer
|
// Read from the beginning of the buffer
|
||||||
unsigned int nReadPosNext = nReadPos + nSize;
|
unsigned int nReadPosNext = nReadPos + nSize;
|
||||||
if (nReadPosNext >= vch.size())
|
if (nReadPosNext >= vch.size())
|
||||||
|
Loading…
Reference in New Issue
Block a user