This commit is contained in:
Jonas Zeunert
2022-09-01 02:01:46 +02:00
parent ce8d374e57
commit 6cd20e34f4

View File

@@ -31,12 +31,12 @@ class GameFactory:
PLAYER_LAMPS.activateNext()
def getHighScore(self):
with open(config.HIGHSCORE_FILE, "w+") as file:
score_str = file.readline()
file.close()
if score_str == "":
score_str = "0"
try:
with open(config.HIGHSCORE_FILE, "r") as file:
score_str = file.readline()
file.close()
except IOError:
return 0
return int(score_str)