From b9884068c6668bf2a89dc404a11c0e5ad82bb06b Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Mon, 1 Jan 2018 15:08:16 +0000 Subject: [PATCH] fix exception on empty response in get_server_list --- steam/client/builtins/gameservers.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/steam/client/builtins/gameservers.py b/steam/client/builtins/gameservers.py index 4904882..7e5aec7 100644 --- a/steam/client/builtins/gameservers.py +++ b/steam/client/builtins/gameservers.py @@ -103,16 +103,20 @@ class SteamGameServers(object): resp = self.steam.unified_messages.send_and_wait("GameServers.GetServerList#1", { "filter": filter_text, "limit": max_servers, - }, timeout=30) + }, timeout=20) - if resp is None: return None + if resp is None: + return None resp = proto_to_dict(resp) - for server in resp['servers']: - server['steamid'] = SteamID(server['steamid']) + if not resp: + return [] + else: + for server in resp['servers']: + server['steamid'] = SteamID(server['steamid']) - return resp['servers'] + return resp['servers'] def get_ips_from_steamid(self, server_steam_ids): """Resolve IPs from SteamIDs