diff --git a/src/osg/State.cpp b/src/osg/State.cpp index a14bee877..a09e34b0f 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -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)