fix: crashed if stopping a task that didn't run

This commit is contained in:
Mose Müller 2023-08-03 14:20:40 +02:00
parent cf46dbbdde
commit cea831f72c

View File

@ -125,7 +125,7 @@ class TaskManager(AbstractTaskManager):
def stop_task() -> None:
# cancel the task
task = self.tasks.pop(name)
task = self.tasks.pop(name, None)
if task is not None:
self._loop.call_soon_threadsafe(task["task"].cancel)