Check if an AI is being used

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
Chris Cromer 2020-02-25 14:01:02 -03:00
parent 718943d54d
commit e820ad1a79

View File

@ -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());