diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index ae7f72a745..7446f4cfb7 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -39,7 +39,10 @@ std::set SplitStringAndRemoveDuplicateElement(const std::string &st void ReplaceString(std::string &resource_str, const std::string &old_str, const std::string &new_str) { std::string::size_type pos = 0; - while ((pos = resource_str.find(old_str)) != std::string::npos) { resource_str.replace(pos, old_str.length(), new_str); } + while ((pos = resource_str.find(old_str, pos)) != std::string::npos) { + resource_str.replace(pos, old_str.length(), new_str); + pos += new_str.length(); //advance position to continue after replacement + } } }