From 4e9654e2e9d634a1123890b1910e3aa916e1d33d Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 12 Apr 2008 14:21:15 +0000 Subject: Fix crash in m_stripcolor on windows when the colour code is the first item on a line git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9465 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_stripcolor.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 39ba84b9a..9b3f8c2f1 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -129,10 +129,17 @@ class ModuleStripColor : public Module if (seq || ((*i == 2) || (*i == 15) || (*i == 22) || (*i == 21) || (*i == 31))) { - safei = i; - --i; - sentence.erase(safei); - } + if (i != sentence.begin()) + { + safei = i; + --i; + sentence.erase(safei); + } + else + { + sentence.erase(i); + i = sentence.begin(); + } } } } -- cgit v1.2.3