Guard null bastion group in the BSI overlay - #33
Open
grepsedawk wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
NameLayer spams the console with a full stack trace on every player move:
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'shasAccesstreats a null group as a caller bug and logsnew Exception()at INFO, so every qualifying move event prints a stack trace.Fix
Resolve the group once and skip the
hasAccesscall 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 throughhasAccess.Notes
hasAccessmakes 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.GroupManager.getGroup(int)still does a synchronous DB query on the main thread on cache miss.