From 05b201bbacbf1d4d74009851d3d31de8fb6b547c Mon Sep 17 00:00:00 2001 From: Ally Piechowski Date: Wed, 24 Jun 2026 03:36:13 +0800 Subject: [PATCH] Guard /nl member sort against null names The member list sorts by current name via String.CASE_INSENSITIVE_ORDER, which dereferences the name to compare characters. When name-api returns null for a member (its data is populated separately and can be stale or unreachable), the comparator throws and opening /nl crashes with a NullPointerException. Wrap the comparator in Comparator.nullsLast so null-named members sort to the end instead of crashing the GUI. This does not fix the underlying name-api lookup; names still resolve to null until that connection is healthy. It just keeps the GUI usable when they do. --- .../main/java/vg/civcraft/mc/namelayer/gui/MainGroupGUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/namelayer-paper/src/main/java/vg/civcraft/mc/namelayer/gui/MainGroupGUI.java b/plugins/namelayer-paper/src/main/java/vg/civcraft/mc/namelayer/gui/MainGroupGUI.java index 732490c61..b8d2d1ff7 100644 --- a/plugins/namelayer-paper/src/main/java/vg/civcraft/mc/namelayer/gui/MainGroupGUI.java +++ b/plugins/namelayer-paper/src/main/java/vg/civcraft/mc/namelayer/gui/MainGroupGUI.java @@ -337,7 +337,7 @@ public void clicked(Player arg0) { } List allMembers = g.getAllMembers(); allMembers.sort(Comparator.comparing(g::isOwner).thenComparing(g::getPlayerType).reversed() - .thenComparing(NameLayerAPI::getCurrentName, String.CASE_INSENSITIVE_ORDER)); + .thenComparing(NameLayerAPI::getCurrentName, Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER))); for (UUID uuid : allMembers) { Clickable c = null; switch (g.getPlayerType(uuid)) {