Fix None drop context crash
This commit is contained in:
1 parent
1a1117b90c
commit
beca65e271
1 file changed
+2
-1
@@ -371,6 +371,7 @@ class Twitch:
|
|||||||
# we need to use GQL to get the current progress
|
# we need to use GQL to get the current progress
|
||||||
context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"])
|
context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"])
|
||||||
drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"]
|
drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"]
|
||||||
|
if drop_data:
|
||||||
drop_id = drop_data["dropID"]
|
drop_id = drop_data["dropID"]
|
||||||
drop = self.get_drop(drop_id)
|
drop = self.get_drop(drop_id)
|
||||||
if drop is None:
|
if drop is None:
|
||||||
@@ -515,7 +516,7 @@ class Twitch:
|
|||||||
for attempt in range(8):
|
for attempt in range(8):
|
||||||
context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"])
|
context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"])
|
||||||
drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"]
|
drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"]
|
||||||
if drop_data["dropID"] != drop.id:
|
if not drop_data or drop_data["dropID"] != drop.id:
|
||||||
break
|
break
|
||||||
await asyncio.sleep(2)
|
await asyncio.sleep(2)
|
||||||
self.restart_watching()
|
self.restart_watching()
|
||||||
|
|||||||
Reference in new issue
Block a user