未验证 提交 6591f5bd 编写于 作者: S s-hadinger 提交者: GitHub

Fix replace() failing (#6224)

上级 0ea485e5
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册