Skip to content

Commit

Permalink
Fixed Typed[Client/Say/Server]Command instances from raising on unloa…
Browse files Browse the repository at this point in the history
…d if they failed to register.
  • Loading branch information
L'In20Cible committed Oct 25, 2016
1 parent cd4b301 commit dc8efe6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions addons/source-python/packages/source-python/commands/typed.py
Expand Up @@ -6,7 +6,9 @@
# =============================================================================
# >> IMPORTS
# =============================================================================
# Python
# Python Imports
# Contextlib
from contextlib import suppress
# Inspect
import inspect
from inspect import Parameter
Expand Down Expand Up @@ -453,9 +455,10 @@ def __call__(self, callback):
return callback

def _unload_instance(self):
if self.parser.remove_command(self.commands):
self.manager.unregister_commands(
self.command.command_to_register, self.on_command)
with suppress(ValueError):
if self.parser.remove_command(self.commands):
self.manager.unregister_commands(
self.command.command_to_register, self.on_command)

@classmethod
def on_command(cls, command, *args):
Expand Down

0 comments on commit dc8efe6

Please sign in to comment.