From af6d5fcd117326d795ad193f9d45b9fc6951a109 Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 16 Nov 2020 20:18:51 +0100 Subject: [PATCH] Fix NPE in PacketProcessor --- src/de/steamwar/spectatesystem/PacketProcessor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/spectatesystem/PacketProcessor.java b/src/de/steamwar/spectatesystem/PacketProcessor.java index 737bb7a..de62fe3 100644 --- a/src/de/steamwar/spectatesystem/PacketProcessor.java +++ b/src/de/steamwar/spectatesystem/PacketProcessor.java @@ -88,7 +88,11 @@ class PacketProcessor { private void entityDespawns() throws IOException{ int entityId = source.rInt(); - Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> REntity.getEntity(entityId).remove()); + Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> { + REntity rEntity = REntity.getEntity(entityId); + if (rEntity == null) return; + rEntity.remove(); + }); } private void entitySneak() throws IOException { -- 2.39.5