Ensure that potential adjacent tiles are not null (puzzlebox)

This commit is contained in:
Alejandro 2020-01-28 00:18:46 +02:00
parent a5f4df51ac
commit be6b206211

View File

@ -53,7 +53,7 @@ public class InteractionPuzzleBox extends HabboItem {
room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.WEST.getValue())
}
)
.filter(t -> t.isWalkable() && !room.hasHabbosAt(t.x, t.y))
.filter(t -> t != null && t.isWalkable() && !room.hasHabbosAt(t.x, t.y))
.min(Comparator.comparingDouble(a -> a.distance(client.getHabbo().getRoomUnit().getCurrentLocation())));
nearestTile.ifPresent(roomTile -> client.getHabbo().getRoomUnit().setGoalLocation(roomTile));