set proto only if it was given

This commit is contained in:
əlemi 2022-04-19 11:46:35 +02:00
parent 923dfa3532
commit c87dbd63e2
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -239,7 +239,8 @@ class Treepuncher(
async def _work(self):
try:
server_data = await self.info()
self.dispatcher.set_proto(server_data['version']['protocol'])
if "version" in server_data and "protocol" in server_data["version"]:
self.dispatcher.set_proto(server_data['version']['protocol'])
except Exception:
return self.logger.exception("exception while pinging server")
while self._processing: