mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-21 21:44:19 +00:00
#3: Do not crash if a CancelSignal is sent to a non-cancellable wait
This commit is contained in:
parent
6680797a72
commit
575ca37033
1 changed files with 7 additions and 3 deletions
10
worker.py
10
worker.py
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue