check we have a mode before trying to remove it

This commit is contained in:
jesopo 2019-06-21 11:14:10 +01:00
parent 4690f3f45d
commit 01438f28f6

View file

@ -158,7 +158,8 @@ class Server(IRCObject.Object):
def add_own_mode(self, mode: str, arg: str=None):
self.own_modes[mode] = arg
def remove_own_mode(self, mode: str):
del self.own_modes[mode]
if mode in self.own_modes:
del self.own_modes[mode]
def change_own_mode(self, remove: bool, mode: str, arg: str=None):
if remove:
self.remove_own_mode(mode)