From 32752256375a34d7d27bb46459a7743bee1f9641 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Fri, 22 Oct 2021 20:11:46 +0100 Subject: [PATCH] SteamLeaderboard: make data param optional --- steam/client/builtins/leaderboards.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/steam/client/builtins/leaderboards.py b/steam/client/builtins/leaderboards.py index 45b23ce..d391304 100644 --- a/steam/client/builtins/leaderboards.py +++ b/steam/client/builtins/leaderboards.py @@ -75,13 +75,14 @@ class SteamLeaderboard(object): display_type = ELeaderboardDisplayType.NONE #: :class:`steam.enums.common.ELeaderboardDisplayType` data_request = ELeaderboardDataRequest.Global #: :class:`steam.enums.common.ELeaderboardDataRequest` - def __init__(self, steam, app_id, name, data): + def __init__(self, steam, app_id, name, data=None): self._steam = steam self.app_id = app_id - for field in data.DESCRIPTOR.fields: - if field.name.startswith('leaderboard_'): - self.__dict__[field.name.replace('leaderboard_', '')] = getattr(data, field.name) + if data is not None: + for field in data.DESCRIPTOR.fields: + if field.name.startswith('leaderboard_'): + self.__dict__[field.name.replace('leaderboard_', '')] = getattr(data, field.name) self.sort_method = ELeaderboardSortMethod(self.sort_method) self.display_type = ELeaderboardDisplayType(self.display_type)