Fix a crash when there's no available campaigns
This commit is contained in:
1 parent
8d77a362b5
commit
ab202279dd
1 file changed
+7
-3
@@ -650,9 +650,13 @@ class Twitch:
|
||||
async def fetch_inventory(self) -> None:
|
||||
response = await self.gql_request(GQL_OPERATIONS["Inventory"])
|
||||
inventory = response["data"]["currentUser"]["inventory"]
|
||||
self.inventory = [
|
||||
DropsCampaign(self, data) for data in inventory["dropCampaignsInProgress"]
|
||||
]
|
||||
if inventory["dropCampaignsInProgress"]: # None with no available campaigns
|
||||
self.inventory = [
|
||||
DropsCampaign(self, data) for data in inventory["dropCampaignsInProgress"]
|
||||
]
|
||||
else:
|
||||
# can happen if the user has no active campaigns yet
|
||||
self.inventory = []
|
||||
|
||||
def get_drop(self, drop_id: str) -> Optional[TimedDrop]:
|
||||
for campaign in self.inventory:
|
||||
|
||||
Reference in new issue
Block a user