Prevent NPE when setting tempt target to null

By: chickeneer <emcchickeneer@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2017-06-03 00:44:10 -05:00
parent f25ad2b556
commit 7b45ff54ad

View file

@ -34,7 +34,7 @@
+ if (event.isCancelled()) {
+ return false;
+ }
+ this.target = ((CraftLivingEntity) event.getTarget()).getHandle();
+ this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle();
+ }
+ return tempt;
+ // CraftBukkit end