Fix uninitialized variables in posting battle result with empty overview data

This commit is contained in:
Xie Zhihao
2024-03-19 08:24:04 +08:00
committed by GitHub
parent 81030982fd
commit f075e4d404

2
s3s.py
View File

@@ -679,6 +679,7 @@ def prepare_battle_result(battle, ismonitoring, isblackout, overview_data=None):
overview_data = None
print("Failed to get recent Anarchy Battles. Proceeding without information on current rank.")
if overview_data is not None:
ranked_list = []
for screen in overview_data:
if "bankaraBattleHistories" in screen["data"]:
ranked_list = screen["data"]["bankaraBattleHistories"]["historyGroups"]["nodes"]
@@ -766,6 +767,7 @@ def prepare_battle_result(battle, ismonitoring, isblackout, overview_data=None):
overview_data = None
print("Failed to get recent X Battles. Proceeding without some information on X Power.")
if overview_data is not None:
x_list = []
for screen in overview_data:
if "xBattleHistories" in screen["data"]:
x_list = screen["data"]["xBattleHistories"]["historyGroups"]["nodes"]