Skip to content

Avoid empty alternative command buckets - #6623

Open
HP-network wants to merge 1 commit into
EssentialsX:2.xfrom
HP-network:fix/alternative-command-empty-list
Open

Avoid empty alternative command buckets#6623
HP-network wants to merge 1 commit into
EssentialsX:2.xfrom
HP-network:fix/alternative-command-empty-list

Conversation

@HP-network

Copy link
Copy Markdown

Information

This PR fixes #6608.

Details

Proposed fix:
When stale WeakReference entries are removed from an alternative-command bucket, the bucket can become empty before the fallback lookup. Return null instead of reading index 0. A regression test covers a bucket whose entries have all been collected.

Environments tested:
OS: macOS
Java version: 21

  • Most recent Paper version (26.2 build API used by the test suite)

Demonstration:
The regression test fails on the previous code with IndexOutOfBoundsException in getAlternative, and passes with this change. The full EssentialsX module suite also passes (35 tests).

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.

IndexOutOfBoundsException on player join

1 participant