Fix crash if no players are online

This commit is contained in:
sqozz 2021-05-10 18:04:43 +02:00
parent 32847e3f5d
commit b5a570c4ec
1 changed files with 6 additions and 2 deletions

View File

@ -55,8 +55,12 @@ def currentPlayerData():
player["count"]["current"] = status.players.online player["count"]["current"] = status.players.online
player["count"]["max"] = status.players.max player["count"]["max"] = status.players.max
player["players"] = [] player["players"] = []
for p in status.players.sample: try:
player["players"].append({"name": p.name, "uuid": p.id}) for p in status.players.sample:
player["players"].append({"name": p.name, "uuid": p.id})
except TypeError:
# If nobody is online, status.players.sample is None
pass
return player return player
def fetchSkin(uuid): def fetchSkin(uuid):