From b2c2d98dd1198f8ddac2c7f1751e0ea19d5d8533 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Wed, 22 Jun 2022 01:37:04 +0200 Subject: [PATCH] fix NPE in IPlayerManager#getOnlyVisibleFor(...) --- .../java/fr/pandacube/lib/core/players/IPlayerManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java b/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java index 978b8a9..6f37aeb 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/IPlayerManager.java @@ -115,12 +115,13 @@ public abstract class IPlayerManager getOnlyVisibleFor(OF viewer) { List players = getAll(); - players.removeIf(op -> op.isVanishedFor(viewer)); + if (viewer != null) + players.removeIf(op -> op.isVanishedFor(viewer)); return players; } public List getOnlyVisibleFor(OP viewer, boolean sameServerOnly) { - if (sameServerOnly && viewer.getServerName() == null) + if (sameServerOnly && (viewer == null || viewer.getServerName() == null)) return Collections.emptyList(); @SuppressWarnings("unchecked")