From 9de08b00713816199e22ac7a3d9c3544732eb268 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Wed, 31 Jan 2024 21:09:22 +0100 Subject: [PATCH] refactoring: Fixed invalid return in Map --- src/main/java/pacmanGame/Map.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/pacmanGame/Map.java b/src/main/java/pacmanGame/Map.java index 0927b56..4abc105 100644 --- a/src/main/java/pacmanGame/Map.java +++ b/src/main/java/pacmanGame/Map.java @@ -77,6 +77,14 @@ public class Map { } public Cell GetCell(Vector2 pos) { - return cells[pos.x][pos.y]; + if(pos.isWithin(size)) { + + return cells[pos.x][pos.y]; + } + else { + + return cells[0][0]; + } + } }