Skip to content

Commit

Permalink
Add check in path checker for empty lists
Browse files Browse the repository at this point in the history
Signed-off-by: jparisu <[email protected]>
  • Loading branch information
jparisu committed Feb 1, 2024
1 parent c84520b commit 8e70272
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sIArena/terrain/Terrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def is_full_path(self, path: Path) -> bool:

def is_valid_path(self, path: Path) -> bool:
"""Returns True if the given path is valid"""
if path is None or len(path) == 0:
return False

for i in range(len(path) - 1):
if path[i + 1] not in self.get_neighbors(path[i]):
return False
Expand Down

0 comments on commit 8e70272

Please sign in to comment.