Skip to content

Guard /nl GUI against null member names - #39

Open
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:nl-null-pointer
Open

Guard /nl GUI against null member names#39
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:nl-null-pointer

Conversation

@grepsedawk

Copy link
Copy Markdown

Opening /nl <group> throws a NullPointerException when name-api returns null for any member. The member list sorts by current name with String.CASE_INSENSITIVE_ORDER, which dereferences the name to compare characters, so one null member crashes the whole GUI before it opens.

Comparator.nullsLast sorts null-named members to the end instead of crashing.

This does not fix the underlying name-api error. name-api is populated separately and can be stale or unreachable; until that connection is healthy, those members still resolve to null and render as "null" in the GUI. This change only ensures /nl stays usable under those same conditions instead of failing to open.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant