- /* Set, and make sure that the mode handler knows this mode was now set */
- Ptr->SetPrefix(user, mh->GetModeChar(), true);
- mh->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, Ptr, nick, true);
+ ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL);
+ if (mh)
+ {
+ std::string nick = user->nick;
+ /* Set, and make sure that the mode handler knows this mode was now set */
+ this->SetPrefix(user, mh->GetModeChar(), true);
+ mh->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, this, nick, true);
+ }