Skip to content

Guard null bastion group in the BSI overlay - #33

Open
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:fix-bastion-overlay-null-group
Open

Guard null bastion group in the BSI overlay#33
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:fix-bastion-overlay-null-group

Conversation

@grepsedawk

Copy link
Copy Markdown

Problem

NameLayer spams the console with a full stack trace on every player move:

[NameLayer] hasAccess failed, caller passed in null
java.lang.Exception: null
    at GroupManager.hasAccess(GroupManager.java:438)
    at ModeListener.updateDisplayedInformation(ModeListener.java:113)
    at ModeListener.onPlayerMove(ModeListener.java:83)

Root cause

The BSI overlay calls hasAccess(bastion.getGroup(), ...) for each blocking bastion. getGroup() returns null when the bastion's reinforcement isn't loaded — its block sits on an unloaded chunk at the field edge while the field still covers the moving player. NameLayer's hasAccess treats a null group as a caller bug and logs new Exception() at INFO, so every qualifying move event prints a stack trace.

Fix

Resolve the group once and skip the hasAccess call when it's null, classifying the bastion as not-allied directly. Display behaviour is unchanged — an unresolved group already fell into the enemy bucket — it just no longer routes a null through hasAccess.

Notes

  • A companion change in NameLayer's hasAccess makes a null group a quiet deny (a null perm is still logged as a real caller bug); this Bastion guard is defense-in-depth on the caller side and also avoids the redundant lookup.
  • Out of scope: GroupManager.getGroup(int) still does a synchronous DB query on the main thread on cache miss.

getGroup() returns null when a blocking bastion's reinforcement isn't
loaded (its block is on an unloaded chunk at the field edge). The
overlay passed that null straight to GroupManager.hasAccess on every
move event, which logs a stack trace for a null group. Resolve the
group once and treat a null as not-allied directly, matching the prior
display (an unresolved group already counted as enemy) without the
spam.
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