Skip to content

Commit

Permalink
Update ChunkListener to fix a minor NPE bug
Browse files Browse the repository at this point in the history
Fixes a NullPointerException at the root of the problem. Bukkit.getPlayer(UUID) can return a null value, so a simple null check will do the trick.
  • Loading branch information
A248 committed Nov 7, 2019
1 parent 81b2bc3 commit b562181
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -45,8 +45,12 @@ public void onChunkUnload(ChunkUnloadEvent event) {
if (npc.getAutoHidden().contains(uuid)) {
continue;
}

npc.hide(Bukkit.getPlayer(uuid), true);

// Bukkit.getPlayer(uuid) sometimes returns null
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
npc.hide(player, true);
}
}
}
}
Expand Down

0 comments on commit b562181

Please sign in to comment.