From 74839e9843ed7a222f46e5db027ae3e57e2307ee Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 4 Apr 2021 11:31:43 +0800 Subject: [PATCH] Fix NPE in lookclose --- main/src/main/java/net/citizensnpcs/trait/LookClose.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/LookClose.java b/main/src/main/java/net/citizensnpcs/trait/LookClose.java index 674a97336..f78f6fad7 100644 --- a/main/src/main/java/net/citizensnpcs/trait/LookClose.java +++ b/main/src/main/java/net/citizensnpcs/trait/LookClose.java @@ -54,9 +54,11 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable } private boolean canSee(Player player) { + if (player == null || !player.isValid()) + return false; return realisticLooking && npc.getEntity() instanceof LivingEntity ? ((LivingEntity) npc.getEntity()).hasLineOfSight(player) - : player != null && player.isValid(); + : false; } /**