mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-06-26 09:25:26 -06:00
Fix endless loop in ReplaceString (#9077)
This commit is contained in:
parent
108eeaed0a
commit
00811ee5bb
1 changed files with 4 additions and 1 deletions
|
@ -39,7 +39,10 @@ std::set<std::string> 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue