Resolve WString TODO (#6190)

Resolve TODO (XXX) by logging warning message.
This commit is contained in:
mrengineer7777
2022-01-31 05:07:37 -06:00
committed by GitHub
parent cbeb7c4df8
commit 9fe34f6553

View File

@ -24,6 +24,7 @@
#include <Arduino.h>
#include "WString.h"
#include "stdlib_noniso.h"
#include "esp32-hal-log.h"
/*********************************************/
/* Constructors */
@ -774,7 +775,8 @@ void String::replace(const String& find, const String& replace) {
if(size == len())
return;
if(size > capacity() && !changeBuffer(size))
return; // XXX: tell user!
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();