From 58f102af60f7e150982bd3eb2801ec18256ce0aa Mon Sep 17 00:00:00 2001 From: Dominic Zimmer Date: Sun, 30 Oct 2022 11:44:03 +0100 Subject: [PATCH] Fix anarchy crash on empty inputs --- backend/backend/arbiter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/backend/arbiter.py b/backend/backend/arbiter.py index 5168f12..4128fb3 100644 --- a/backend/backend/arbiter.py +++ b/backend/backend/arbiter.py @@ -196,13 +196,13 @@ async def _(get_input: InputGetter, set_output: OutputSetter): await asyncio.sleep(settings.democracy_vote_cycle) inputs: list[Input] = await get_input() - - the_input = random.choice(inputs) - if not the_input: + if not inputs: set_output(EMPTY_INPUT) continue + the_input = random.choice(inputs) + output = {button: the_input[button] for button in Button} set_output(output)