Only try remove callbacks when not None (#268)

This commit is contained in:
Jesse Hills 2022-10-03 12:32:13 +13:00 committed by GitHub
parent fa41b09232
commit a6f18ae9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -421,7 +421,7 @@ class APIClient:
) )
def unsub() -> None: def unsub() -> None:
assert self._connection is not None if self._connection is not None:
self._connection.remove_message_callback(on_msg) self._connection.remove_message_callback(on_msg)
return unsub return unsub
@ -442,7 +442,7 @@ class APIClient:
) )
def unsub() -> None: def unsub() -> None:
assert self._connection is not None if self._connection is not None:
self._connection.remove_message_callback(on_msg) self._connection.remove_message_callback(on_msg)
return unsub return unsub
@ -474,7 +474,7 @@ class APIClient:
) )
def unsub() -> None: def unsub() -> None:
assert self._connection is not None if self._connection is not None:
self._connection.remove_message_callback(on_msg) self._connection.remove_message_callback(on_msg)
try: try:
@ -633,7 +633,9 @@ class APIClient:
) )
async def stop_notify() -> None: async def stop_notify() -> None:
assert self._connection is not None if self._connection is None:
return
self._connection.remove_message_callback(on_msg) self._connection.remove_message_callback(on_msg)
self._check_authenticated() self._check_authenticated()