From e820ad1a79d3899e997f3fc9557683a4f129e0ed Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Tue, 25 Feb 2020 14:01:02 -0300 Subject: [PATCH] Check if an AI is being used Signed-off-by: Chris Cromer --- src/main/java/cl/cromer/azaraka/object/Key.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/cl/cromer/azaraka/object/Key.java b/src/main/java/cl/cromer/azaraka/object/Key.java index 1ae1301..a7e2d13 100644 --- a/src/main/java/cl/cromer/azaraka/object/Key.java +++ b/src/main/java/cl/cromer/azaraka/object/Key.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Chris Cromer + * Copyright 2020 Chris Cromer * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * @@ -118,7 +118,9 @@ public class Key extends Object implements Constants { getCell().setObjectOnBottom(null); setState(State.HELD); try { - getScene().getCanvas().getPlayer().getAi().removeKeyDestination(getCell().getX(), getCell().getY()); + if (getScene().getCanvas().getPlayer().getAi() != null) { + getScene().getCanvas().getPlayer().getAi().removeKeyDestination(getCell().getX(), getCell().getY()); + } } catch (AIException e) { getLogger().warning(e.getMessage());