From 9753fa2931a338ae9cc0e7625af91d2626e5bdae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Fri, 13 May 2016 17:23:37 +0200 Subject: [PATCH] added null check to PlayerBase.move() --- cicaprojekt/PlayerBase.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cicaprojekt/PlayerBase.java b/cicaprojekt/PlayerBase.java index 0c9ea9e..12fdf32 100644 --- a/cicaprojekt/PlayerBase.java +++ b/cicaprojekt/PlayerBase.java @@ -33,8 +33,12 @@ public class PlayerBase implements Destroyable { public void move(Direction direction) { this.setFacingDirection(direction); Tile tile = this.getCurrentTile().getAdjacentTile(direction); - tile.onEntry(this); - setCurrentTile(tile); + + if (tile != null) + { + tile.onEntry(this); + setCurrentTile(tile); + } } public void pickZPM(Tile tile) { /* PlayerBase does not collect ZPM modules */ }