diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 4714c582f..20ccc770d 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -38,7 +38,12 @@ 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); } + size_t new_size = 0; + while ((pos = resource_str.find(old_str, pos + new_size)) != std::string::npos) + { + resource_str.replace(pos, old_str.length(), new_str); + new_size = new_str.size(); + } } }