aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Attila Molnar2015-09-28 10:36:17 +0200
committerGravatar Attila Molnar2015-09-28 10:36:17 +0200
commitb2db94675b1881ab40f2e6c625f716f79e1efcc4 (patch)
tree6a95d85f7a24d61686f3adc4c6cdf155e8313bf2 /src/modules
parentMerge pull request #1050 from Aviator45003/insp20 (diff)
downloadinspircd++-b2db94675b1881ab40f2e6c625f716f79e1efcc4.tar.gz
inspircd++-b2db94675b1881ab40f2e6c625f716f79e1efcc4.tar.bz2
inspircd++-b2db94675b1881ab40f2e6c625f716f79e1efcc4.zip
Fix incorrect std::string::operator[] usage
Passing a position equal to length() to the non-const version of operator[] is undefined
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_namedmodes.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 9c5c414f1..5063368b8 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -174,7 +174,7 @@ class CommandCheck : public Command
/* /check on a channel */
user->SendText(checkstr + " timestamp " + timestring(targchan->age));
- if (targchan->topic[0] != 0)
+ if (!targchan->topic.empty())
{
/* there is a topic, assume topic related information exists */
user->SendText(checkstr + " topic " + targchan->topic);
diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp
index 4db1f70b9..cad18cff4 100644
--- a/src/modules/m_namedmodes.cpp
+++ b/src/modules/m_namedmodes.cpp
@@ -65,6 +65,8 @@ class CommandProp : public Command
while (i < parameters.size())
{
std::string prop = parameters[i++];
+ if (prop.empty())
+ continue;
bool plus = prop[0] != '-';
if (prop[0] == '+' || prop[0] == '-')
prop.erase(prop.begin());