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: * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* *
@ -118,8 +118,10 @@ public class Key extends Object implements Constants {
getCell().setObjectOnBottom(null); getCell().setObjectOnBottom(null);
setState(State.HELD); setState(State.HELD);
try { try {
if (getScene().getCanvas().getPlayer().getAi() != null) {
getScene().getCanvas().getPlayer().getAi().removeKeyDestination(getCell().getX(), getCell().getY()); getScene().getCanvas().getPlayer().getAi().removeKeyDestination(getCell().getX(), getCell().getY());
} }
}
catch (AIException e) { catch (AIException e) {
getLogger().warning(e.getMessage()); getLogger().warning(e.getMessage());
} }