summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h3
-rw-r--r--src/channels.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/include/users.h b/include/users.h
index 28b370725..ef19adb5d 100644
--- a/include/users.h
+++ b/include/users.h
@@ -932,5 +932,6 @@ inline bool User::IsModeSet(UserModeReference& moderef) const
inline void User::SetMode(ModeHandler* mh, bool value)
{
- modes[mh->GetId()] = value;
+ if (mh && mh->GetId() != ModeParser::MODEID_MAX)
+ modes[mh->GetId()] = value;
}
diff --git a/src/channels.cpp b/src/channels.cpp
index c9816db4b..e25500892 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -40,7 +40,8 @@ Channel::Channel(const std::string &cname, time_t ts)
void Channel::SetMode(ModeHandler* mh, bool on)
{
- modes[mh->GetId()] = on;
+ if (mh && mh->GetId() != ModeParser::MODEID_MAX)
+ modes[mh->GetId()] = on;
}
void Channel::SetTopic(User* u, const std::string& ntopic, time_t topicts, const std::string* setter)