-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chore: remove finite check from LocalPlayer #4662
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we don't want to hide any bigger problem with that but maybe instead of removing null checks entirely, we could consider throwing a reasonable exception instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not having explicit checks for the one-line methods getPosition
, getRotation
, and getVelocity
is completely fine. The only thing we gain here is a user-readable message, but an NPE already pins it down to a single point of failure.
A similar argument holds for getViewPosition
and getViewRotation
. The line in which the NPE would occur indicates well enough what the issue is (at least to the devs).
We might add todo items to revisit this when we have better exception handling (soft and hard errors for crashing to menu or to desktop).
This reverts commit ac62052.
we've mentioned in the past having a situation where the player position is placed at (0,0,0). I'm suspecting it has something to do with this logic. so for an invalid position we just return dest or a new Vector3/Quaternion. we shouldn't be just defaulting to 0,0,0. this ends up hiding a larger underlying problem where we see some odd behavior but we've written this logic in a way to hide a large problem. I rather have the game crash with a stacktrace then try poking at thing in the dark because we've written ourselves into a corner.
#4152