From 36dd627eb7976ba6c0f90459338950c00174264a Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Sat, 6 Nov 2021 09:29:02 -0400 Subject: [PATCH] Correct crash when trash is picked up outside of calculated "ideal ordering" --- src/entities/system_entities.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/entities/system_entities.py b/src/entities/system_entities.py index a366c9d..b06b42c 100644 --- a/src/entities/system_entities.py +++ b/src/entities/system_entities.py @@ -1223,8 +1223,9 @@ class TrashPile: # Update trash entity data. tile_id = '{0}, {1}'.format(self.tile_x, self.tile_y) self.data_manager.graph.data['trash_tiles'].remove(tile_id) - if self.data_manager.ideal_overall_path['ordering'][1] == tile_id: - self.data_manager.ideal_overall_path['ordering'].pop(1) + # Remove tile from path ordering, if present. + if tile_id in self.data_manager.ideal_overall_path['ordering']: + self.data_manager.ideal_overall_path['ordering'].remove(tile_id) else: logger.info('No trash to clean at tile ({0}, {1}).'.format(self.tile_x, self.tile_y)) -- GitLab