mirror of
https://github.com/espressif/arduino-esp32
synced 2024-09-21 18:38:17 +00:00
Fix replace() failing (#6224)
This commit is contained in:
parent
0ea485e518
commit
6591f5bd4c
@ -774,9 +774,10 @@ void String::replace(const String& find, const String& replace) {
|
||||
}
|
||||
if(size == len())
|
||||
return;
|
||||
if(size > capacity() && !changeBuffer(size))
|
||||
if(size > capacity() && !changeBuffer(size)) {
|
||||
log_w("String.Replace() Insufficient space to replace string");
|
||||
return;
|
||||
}
|
||||
int index = len() - 1;
|
||||
while(index >= 0 && (index = lastIndexOf(find, index)) >= 0) {
|
||||
readFrom = wbuffer() + index + find.len();
|
||||
|
Loading…
Reference in New Issue
Block a user