aboutsummaryrefslogtreecommitdiffstats
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-08-14 19:31:54 -0400
committerGravatar Daniel De Graaf2010-08-14 19:31:54 -0400
commita6ca2f315b98a359de89f428fe8273ffd896541d (patch)
tree0421e19fee008230c2267c9957398926410d8611 /src/mode.cpp
parentDocument the mode/<name> oper permission now preferred in 2.1 (diff)
Don't try to process mode changes with an invalid target
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 163f670f6..67ee485ba 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -526,6 +526,9 @@ void ModeParser::Process(User *src, Extensible* target, irc::modestacker& modes,
Channel* targetchannel = dynamic_cast<Channel*>(target);
User* targetuser = dynamic_cast<User*>(target);
+ if (!targetuser && !targetchannel)
+ return;
+
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnPreMode, MOD_RESULT, (src, target, modes));
@@ -574,7 +577,7 @@ void ModeParser::Process(User *src, Extensible* target, irc::modestacker& modes,
continue;
}
}
-
+
FOREACH_MOD(I_OnMode, OnMode(src, target, modes));
}
@@ -680,7 +683,7 @@ void ModeParser::AddMode(ModeHandler* mh)
if (FindMode(mh->name))
throw ModuleException("Duplicate mode name found");
-
+
// prefixes can't be duplicated
if (mh->GetPrefix() && FindPrefix(mh->GetPrefix()))
throw ModuleException("Duplicate channel prefix found");
@@ -700,7 +703,7 @@ void ModeParser::AddMode(ModeHandler* mh)
if (mc && FindMode(mc, mh->GetModeType()))
throw ModuleException("Duplicate mode character '" + std::string(mc,1) + "' found");
-
+
if (!mc && !ServerInstance->Config->NameOnlyModes)
throw ModuleException("<options:nameonlymodes> must be enabled to clear a mode character");
@@ -933,7 +936,7 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw)
return false;
std::pair<ModeWatcherMap::iterator,ModeWatcherMap::iterator> watchers = modewatchers.equal_range(mh->id);
-
+
while (watchers.first != watchers.second)
{
if (watchers.first->second == mw)