aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/WString.cpp
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2011-10-27 11:41:02 -0400
committerZach Eveland <zeveland@blacklabel-development.com>2011-10-27 11:41:02 -0400
commitec93cd74a187a58f0e2bbe496c38edd7d9f33f30 (patch)
tree3e519cf239c57e915520e60563714dfd6f7948e0 /cores/arduino/WString.cpp
parent415a5e119d11394fc7e7365ff5b7c64a50ef7f64 (diff)
parent5c9d10ad9484c26eb94d2030628b676f8d0d5fc7 (diff)
Merge branch 'new-extension' of github.com:arduino/Arduino into diskloader_reboot
Conflicts: hardware/arduino/variants/mega/pins_arduino.h libraries/Ethernet/examples/PachubeClient/PachubeClient.ino libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino
Diffstat (limited to 'cores/arduino/WString.cpp')
-rw-r--r--cores/arduino/WString.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index ad8d828..3e81331 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -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;