summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-12-12 13:51:26 +0000
committerPeter Powell <petpow@saberuk.com>2018-12-12 14:43:55 +0000
commit51891f10f2a05e16e45651a669db6680a433bf9b (patch)
tree795c43424f68ed0f6ea4e718f955667828d1087e
parent372c5c94964263ba6c1f2f44079aac3aff448225 (diff)
Fix a crash when the core_oper module is not loaded.
-rw-r--r--src/modules/m_spanningtree/opertype.cpp3
-rw-r--r--src/usermanager.cpp1
-rw-r--r--src/users.cpp15
3 files changed, 11 insertions, 8 deletions
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index 473cdb857..99c5ea8bc 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -33,7 +33,8 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& para
ServerInstance->Users->all_opers.push_back(u);
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
- u->SetMode(opermh, true);
+ if (opermh)
+ u->SetMode(opermh, true);
ServerConfig::OperIndex::const_iterator iter = ServerInstance->Config->OperTypes.find(opertype);
if (iter != ServerInstance->Config->OperTypes.end())
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 968d5db00..6f9d15502 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -221,6 +221,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std:
uuidlist.erase(user->uuid);
user->PurgeEmptyChannels();
+ user->UnOper();
}
void UserManager::AddClone(User* user)
diff --git a/src/users.cpp b/src/users.cpp
index 8f20b7523..f11a7a380 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -357,10 +357,12 @@ CullResult FakeUser::cull()
void User::Oper(OperInfo* info)
{
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
- if (this->IsModeSet(opermh))
- this->UnOper();
-
- this->SetMode(opermh, true);
+ if (opermh)
+ {
+ if (this->IsModeSet(opermh))
+ this->UnOper();
+ this->SetMode(opermh, true);
+ }
this->oper = info;
LocalUser* localuser = IS_LOCAL(this);
@@ -474,7 +476,8 @@ void User::UnOper()
stdalgo::vector::swaperase(ServerInstance->Users->all_opers, this);
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
- this->SetMode(opermh, false);
+ if (opermh)
+ this->SetMode(opermh, false);
FOREACH_MOD(OnPostDeoper, (this));
}
@@ -1161,8 +1164,6 @@ void User::PurgeEmptyChannels()
++i;
c->DelUser(this);
}
-
- this->UnOper();
}
void User::WriteNotice(const std::string& text)