1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-24 23:04: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
update = self.__receive_next_update()
# Ensure the update isn't a CancelSignal
if cancellable and isinstance(update, CancelSignal):
# Return the CancelSignal
return update
if isinstance(update, CancelSignal):
if cancellable:
# Return the CancelSignal
return update
else:
# Ignore the signal
continue
# Ensure the update contains a message
if update.message is None:
continue