From e4a9cca14d442b072db0a9ea09dde4d8359b6b43 Mon Sep 17 00:00:00 2001 From: Mawoka Date: Wed, 4 May 2022 19:39:22 +0200 Subject: [PATCH] :bug: Fixed crash --- classquiz/routers/quiz.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classquiz/routers/quiz.py b/classquiz/routers/quiz.py index cb01c77..2c865e8 100644 --- a/classquiz/routers/quiz.py +++ b/classquiz/routers/quiz.py @@ -109,7 +109,10 @@ async def check_if_captcha_enabled(game_pin: str): game = await redis.get(f"game:{game_pin}") if game is None: return JSONResponse(status_code=404, content={"detail": "game not found"}) - return CheckIfCaptchaEnabledResponse(**{"enabled": json.loads(game)["captcha_enabled"]}) + try: + return CheckIfCaptchaEnabledResponse(**{"enabled": json.loads(game)["captcha_enabled"]}) + except KeyError or TypeError: + return CheckIfCaptchaEnabledResponse(**{"enabled": True}) @router.get("/join/{game_pin}")