Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup method handle utils & fix npe #1284

Merged
merged 1 commit into from
Dec 26, 2023
Merged

Conversation

Pablete1234
Copy link
Member

Fixes an NPE that may occur when a player not in the match does certain events that are matched by a dynamic filter:

[MatchImpl] Unable to invoke cached MethodHandle extracting Filterable for org.bukkit.event.player.PlayerItemHeldEvent@4f28c252
java.lang.NullPointerException
 	at java.base/java.util.Objects.requireNonNull(Objects.java:221)
 	at tc.oc.pgm.filters.FilterMatchModule.invalidate(FilterMatchModule.java:427)
 	at tc.oc.pgm.filters.FilterMatchModule.lambda$registerListenersFor$17(FilterMatchModule.java:469)

This rooted from the PlayerItemHeldEvent having a player, but match.getPlayer(bukkitPlayer) returning null (player not properly in the match) which caused the npe when trying to invalidate.

Also does a bit of a cleanup of method handle finding

@Pablete1234 Pablete1234 added the bug Something isn't working label Dec 14, 2023
@Electroid Electroid merged commit 682f968 into dev Dec 26, 2023
2 checks passed
@Electroid Electroid deleted the fix-npe-dynamic-filters branch December 26, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants