mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Make String::move of an invalidated String result in an invalidated String
This commit is contained in:
parent
b8f3d2d8bb
commit
f49c7ae3de
@ -193,7 +193,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
|
|||||||
void String::move(String &rhs)
|
void String::move(String &rhs)
|
||||||
{
|
{
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
if (capacity >= rhs.len) {
|
if (rhs && capacity >= rhs.len) {
|
||||||
strcpy(buffer, rhs.buffer);
|
strcpy(buffer, rhs.buffer);
|
||||||
len = rhs.len;
|
len = rhs.len;
|
||||||
rhs.len = 0;
|
rhs.len = 0;
|
||||||
|
@ -195,7 +195,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
|
|||||||
void String::move(String &rhs)
|
void String::move(String &rhs)
|
||||||
{
|
{
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
if (capacity >= rhs.len) {
|
if (rhs && capacity >= rhs.len) {
|
||||||
strcpy(buffer, rhs.buffer);
|
strcpy(buffer, rhs.buffer);
|
||||||
len = rhs.len;
|
len = rhs.len;
|
||||||
rhs.len = 0;
|
rhs.len = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user