1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-22 05:54:18 +00:00

#3: Do not crash if a CancelSignal is sent to a non-cancellable wait

This commit is contained in:
Steffo 2018-04-13 09:40:31 +02:00
parent 6680797a72
commit 575ca37033

View file

@ -125,9 +125,13 @@ class ChatWorker(threading.Thread):
# Get the next update # Get the next update
update = self.__receive_next_update() update = self.__receive_next_update()
# Ensure the update isn't a CancelSignal # Ensure the update isn't a CancelSignal
if cancellable and isinstance(update, CancelSignal): if isinstance(update, CancelSignal):
# Return the CancelSignal if cancellable:
return update # Return the CancelSignal
return update
else:
# Ignore the signal
continue
# Ensure the update contains a message # Ensure the update contains a message
if update.message is None: if update.message is None:
continue continue