mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
fix utils::string::replaceIP hanging if filter is empty
This commit is contained in:
parent
6e11d0a6b0
commit
4d5e465ade
1 changed files with 2 additions and 0 deletions
|
@ -59,6 +59,8 @@ std::string utils::string::toUpper(std::string const& str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string& utils::string::replaceIP(std::string& str, std::string const& orig, std::string const& repl) {
|
std::string& utils::string::replaceIP(std::string& str, std::string const& orig, std::string const& repl) {
|
||||||
|
if (orig.empty()) return str;
|
||||||
|
|
||||||
std::string::size_type n = 0;
|
std::string::size_type n = 0;
|
||||||
while ((n = str.find(orig, n)) != std::string::npos) {
|
while ((n = str.find(orig, n)) != std::string::npos) {
|
||||||
str.replace(n, orig.size(), repl);
|
str.replace(n, orig.size(), repl);
|
||||||
|
|
Loading…
Reference in a new issue