From 1d9c4e046619f9a4d913e20b38f2cf18906fb416 Mon Sep 17 00:00:00 2001 From: Shawn A <807787+tablatronix@users.noreply.github.com> Date: Wed, 2 Feb 2022 19:25:27 -0600 Subject: [PATCH] FIXES FATAL string replace https://github.com/espressif/arduino-esp32/commit/9fe34f655369e64d7988c482f9d53a758d4dac01 --- cores/esp32/WString.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cores/esp32/WString.cpp b/cores/esp32/WString.cpp index 4badf63d0fe..c2d12cd5e04 100644 --- a/cores/esp32/WString.cpp +++ b/cores/esp32/WString.cpp @@ -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();