Skip to content

Commit fd7d302

Browse files
author
L'In20Cible
committed
Fixed a ValueError when unloading an _EntityHooks instance that failed to register (due to an invalid method name, for example).
1 parent a14df21 commit fd7d302

File tree

1 file changed

+1
-1
lines changed
  • addons/source-python/packages/source-python/entities

1 file changed

+1
-1
lines changed

addons/source-python/packages/source-python/entities/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _unload_instance(self):
137137
"""Unload the hook."""
138138
if self.hooked_function is not None:
139139
self.hooked_function.remove_hook(self.hook_type, self.callback)
140-
else:
140+
elif self in _waiting_entity_hooks:
141141
# If the function is None, the hook wasn't initialized, so it's
142142
# still in the _waiting_entity_hooks dict
143143
_waiting_entity_hooks.remove(self)

0 commit comments

Comments
 (0)