From 51891f10f2a05e16e45651a669db6680a433bf9b Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 12 Dec 2018 13:51:26 +0000 Subject: Fix a crash when the core_oper module is not loaded. --- src/users.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/users.cpp') 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) -- cgit v1.3.1-10-gc9f91