summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 14:45:56 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2012-01-14 14:45:56 +0000
commite6bb19f63ac5562b570928d1bcdb54df3f60aa61 (patch)
tree3ad7c86505b8d18e6c209d519e1a80df51318738
parent3d31c27864f4be0ccc78ea0f0dfa26f9ea2e3e82 (diff)
downloadcraftbukkit-e6bb19f63ac5562b570928d1bcdb54df3f60aa61.tar
craftbukkit-e6bb19f63ac5562b570928d1bcdb54df3f60aa61.tar.gz
craftbukkit-e6bb19f63ac5562b570928d1bcdb54df3f60aa61.tar.lz
craftbukkit-e6bb19f63ac5562b570928d1bcdb54df3f60aa61.tar.xz
craftbukkit-e6bb19f63ac5562b570928d1bcdb54df3f60aa61.zip
Fixed any chance of creatures .getTarget throwing a class cast exception - thanks to an old PR by garbagemule!
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java
index e4f26363..f0d45c47 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java
@@ -24,6 +24,7 @@ public class CraftCreature extends CraftLivingEntity implements Creature {
public CraftLivingEntity getTarget() {
if (getHandle().target == null) return null;
+ if (!(getHandle().target instanceof CraftLivingEntity)) return null;
return (CraftLivingEntity) getHandle().target.getBukkitEntity();
}