Skip to content

Commit 4374ef4

Browse files
authored
Merge pull request #151 from ManualForArchipelago/handle-missing-slot-data
Fix client crash if the server doesn't send slot data
2 parents 1095371 + 6f7125f commit 4374ef4

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/ManualClient.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,15 @@ def on_package(self, cmd: str, args: dict):
197197
if cmd in {"Connected", "DataPackage"}:
198198
if cmd == "Connected":
199199
Utils.persistent_store("client", "last_manual_game", self.game)
200-
goal = args["slot_data"].get("goal")
201-
if goal and goal < len(self.victory_names):
202-
self.goal_location = self.get_location_by_name(self.victory_names[goal])
203-
if args['slot_data'].get('death_link'):
204-
self.ui.enable_death_link()
205-
self.set_deathlink = True
206-
self.last_death_link = 0
207-
logger.info(f"Slot data: {args['slot_data']}")
200+
if args.get("slot_data"):
201+
goal = args["slot_data"].get("goal")
202+
if goal and goal < len(self.victory_names):
203+
self.goal_location = self.get_location_by_name(self.victory_names[goal])
204+
if args['slot_data'].get('death_link'):
205+
self.ui.enable_death_link()
206+
self.set_deathlink = True
207+
self.last_death_link = 0
208+
logger.info(f"Slot data: {args['slot_data']}")
208209

209210
self.ui.build_tracker_and_locations_table()
210211
self.ui.request_update_tracker_and_locations_table(update_highlights=True)

src/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def get_filler_item_name(self) -> str:
7575

7676
def interpret_slot_data(self, slot_data: dict[str, any]):
7777
#this is called by tools like UT
78+
if not slot_data:
79+
return False
7880

7981
regen = False
8082
for key, value in slot_data.items():

0 commit comments

Comments
 (0)