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

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"] = []
try:
for p in status.players.sample: for p in status.players.sample:
player["players"].append({"name": p.name, "uuid": p.id}) 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):