Skip to content

Commit

Permalink
Strip null bytes which fixes FragLand#17
Browse files Browse the repository at this point in the history
  • Loading branch information
ldilley committed Oct 10, 2018
1 parent 63f42cc commit cc95721
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Python/minestat.py
Expand Up @@ -52,9 +52,9 @@ def __init__(self, address, port, timeout = 7):
data = raw_data.decode('cp437').split('\x00\x00\x00')
if data and len(data) >= self.NUM_FIELDS:
self.online = True
self.version = data[2]
self.motd = data[3]
self.current_players = data[4]
self.max_players = data[5]
self.version = data[2].replace("\x00", "")
self.motd = data[3].encode('utf-8').replace("\x00", "")
self.current_players = data[4].replace("\x00", "")
self.max_players = data[5].replace("\x00", "")
else:
self.online = False

0 comments on commit cc95721

Please sign in to comment.