From 73e2e474b3dbd9b58d2d79475c5c0e2948e0be63 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 24 Aug 2023 09:22:10 +0300 Subject: [PATCH] handle 500 error --- files/routes/admin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/routes/admin.py b/files/routes/admin.py index af854b75b1..b58eccfc8d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -183,6 +183,10 @@ def distribute(v, kind, option_id): g.db.add(autojanny) votes = option.votes + + if not votes: + abort(400, "Nobody voted on that, it can't be the winner!") + coinsperperson = int(pool / len(votes)) text = f"You won {coinsperperson} coins betting on {parent.permalink} :marseyparty:"