Skip to content

Commit dc8efe6

Browse files
author
L'In20Cible
committed
Fixed Typed[Client/Say/Server]Command instances from raising on unload if they failed to register.
1 parent cd4b301 commit dc8efe6

File tree

1 file changed

+7
-4
lines changed
  • addons/source-python/packages/source-python/commands

1 file changed

+7
-4
lines changed

addons/source-python/packages/source-python/commands/typed.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# =============================================================================
77
# >> IMPORTS
88
# =============================================================================
9-
# Python
9+
# Python Imports
10+
# Contextlib
11+
from contextlib import suppress
1012
# Inspect
1113
import inspect
1214
from inspect import Parameter
@@ -453,9 +455,10 @@ def __call__(self, callback):
453455
return callback
454456

455457
def _unload_instance(self):
456-
if self.parser.remove_command(self.commands):
457-
self.manager.unregister_commands(
458-
self.command.command_to_register, self.on_command)
458+
with suppress(ValueError):
459+
if self.parser.remove_command(self.commands):
460+
self.manager.unregister_commands(
461+
self.command.command_to_register, self.on_command)
459462

460463
@classmethod
461464
def on_command(cls, command, *args):

0 commit comments

Comments
 (0)