From Aurelien Albert, "I've go some problem with the method "State_Utils::replace" : if the original_phrase is empty, it leads to an infinite loop.
Here is a path to prevent this."
This commit is contained in:
parent
90703f99ee
commit
0c609bc17e
@ -1325,6 +1325,9 @@ namespace State_Utils
|
||||
{
|
||||
bool replace(std::string& str, const std::string& original_phrase, const std::string& new_phrase)
|
||||
{
|
||||
// Prevent infinite loop : if original_phrase is empty, do nothing and return false
|
||||
if (original_phrase.empty()) return false;
|
||||
|
||||
bool replacedStr = false;
|
||||
std::string::size_type pos = 0;
|
||||
while((pos=str.find(original_phrase, pos))!=std::string::npos)
|
||||
|
Loading…
Reference in New Issue
Block a user