Skip to content

Commit

Permalink
FIX: index out of range in online command
Browse files Browse the repository at this point in the history
  • Loading branch information
Bratah123 committed Feb 1, 2024
1 parent 59ba9ac commit baf0b93
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,16 @@ def online(self) -> tuple[dict[str, str], str]:
players = {}
error_message = ""
# format output
if res:
lines = res.split()[1:]
if res: # "name,playeruid,steamid\n" this is the header
lines = res.split()[1:] # remove the header
log.debug(lines)
for line in lines:
words = line.split(",")
players[words[2]] = words[0]
if len(words) != 3:
break
ign = words[0]
steam_id = words[2]
players[steam_id] = ign
else:
error_message = self.GENERIC_ERROR

Expand Down

0 comments on commit baf0b93

Please sign in to comment.