From db5967a52d9409842581276154a6fa9763a57a24 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 27 Apr 2024 01:36:07 +0300 Subject: discard badly formed hiscores --- src/sliceitoff/hiscores/hiscores.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sliceitoff/hiscores/hiscores.py b/src/sliceitoff/hiscores/hiscores.py index d963605..b981077 100644 --- a/src/sliceitoff/hiscores/hiscores.py +++ b/src/sliceitoff/hiscores/hiscores.py @@ -9,8 +9,11 @@ class HiScores: """ On creation load high scores from config file """ self.table=[] for value in settings.get_values("hiscore"): - score, name = value.split('!') - self.add(int(score.strip()),name.strip()) + try: + score, name = value.split('!') + self.add(int(score.strip()),name.strip()) + except ValueError: + pass if len(self.table)