fix NPE on EntityTeleportEvent getTo#10016
Merged
Machine-Maker merged 1 commit intoPaperMC:masterfrom Dec 26, 2023
Merged
Conversation
Member
|
Why not just cancel the event if passed null if the param should stay nullable? |
Member
|
Or honestly, just make it notnull if it's broken anyways lol |
Member
Author
I considered that, but I would also have to change it for all the subclasses of EntityTeleportEvent which have constructors that are marked with |
Owen1212055
approved these changes
Dec 26, 2023
5e2a006 to
daafa23
Compare
lynxplay
pushed a commit
to lynxplay/paper
that referenced
this pull request
Feb 23, 2024
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.
Almost everywhere EntityTeleportEvent (or a subclass) was used, the nullability of getTo was never checked despite it being marked as nullable (as well as setTo). This is really dumb, as what is null supposed to do? So I just made it act as being cancelled.
Also in one spot, the firing of the event for /teleport, the to location wasn't even respected if you called setTo.