From 6591f5bd4cf4d3ef7c9c783680d8b06678d3c449 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 3 Feb 2022 19:07:34 +0100 Subject: [PATCH] Fix replace() failing (#6224) --- 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 4badf63d..f69302a2 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();