libi2ncommon: (tomj) throw exception if replace_all is called with empty search strin...
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 27 Mar 2006 15:17:52 +0000 (15:17 +0000)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 27 Mar 2006 15:17:52 +0000 (15:17 +0000)
src/stringfunc.cpp

index dcc1cde..199b277 100644 (file)
@@ -162,6 +162,9 @@ bool replace_all(string &base, const string &ist, const string &soll)
     bool found_ist = false;
     string::size_type a=0;
 
+    if (ist.empty())
+        throw runtime_error("replace_all called with empty search string");
+
     while((a=base.find(ist,a))!=string::npos)
     {
         base.replace(a,ist.size(),soll);