mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Bug fix in replace().
http://code.google.com/p/arduino/issues/detail?id=694
This commit is contained in:
parent
e1dbe688e9
commit
d9f9676d23
@ -593,7 +593,7 @@ void String::replace(const String& find, const String& replace)
|
||||
if (size == len) return;
|
||||
if (size > capacity && !changeBuffer(size)) return; // XXX: tell user!
|
||||
int index = len - 1;
|
||||
while ((index = lastIndexOf(find, index)) >= 0) {
|
||||
while (index >= 0 && (index = lastIndexOf(find, index)) >= 0) {
|
||||
readFrom = buffer + index + find.len;
|
||||
memmove(readFrom + diff, readFrom, len - (readFrom - buffer));
|
||||
len += diff;
|
||||
|
Loading…
x
Reference in New Issue
Block a user