summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-22 21:45:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-22 21:45:59 +0000
commit2cc838ec2237e11eaa30d0521d34233e8d1701c3 (patch)
tree28c80a6ec6229078812631839c43fa4a67a63487 /src/modules
parentb513b12594c07ee24f1a3c3dc7794fddcd2005c4 (diff)
Fixed issue where ReplaceText threw an exception (!)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@823 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_censor.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 40e4ee92b..769e6e493 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -71,11 +71,14 @@ class ModuleCensor : public Module
virtual void ReplaceLine(std::string &text,std::string pattern, std::string replace)
{
- while (strstr(text.c_str(),pattern.c_str()))
+ if ((pattern != "") && (text != ""))
{
- int pos = text.find(pattern);
- text.erase(pos,pattern.length());
- text.insert(pos,replace);
+ while (strstr(text.c_str(),pattern.c_str()))
+ {
+ int pos = text.find(pattern);
+ text.erase(pos,pattern.length());
+ text.insert(pos,replace);
+ }
}
}