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

Replace all references of blockType with getBlockType to fix NPE #41

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

spacebuilder2020
Copy link

Context: We have been experiencing multiple crashes with Maliss Doors and Advanced Detectors. After looking through PR #39, I discovered that the PR code was changed to use the blockType variable instead of getting the TE from the world. However, as we discovered, this variable is null and according to the vanilla code, it is not set until getBlockType() is called.

As a result, calls to notifyBlocksOfNeighborChange() pass a null block and cause a crash downstream with MalisDoors.
https://github.com/GTNewHorizons/MalisisDoors/blob/master/src/main/java/net/malisis/doors/door/block/Door.java#L254

To fix, I replaced calls to blockType with the method wrapper since that has a null check and if the block object is null, it fetches the object from the world.

@mitchej123 mitchej123 requested a review from a team October 24, 2023 00:01
@mitchej123 mitchej123 merged commit 17c3528 into GTNewHorizons:master Oct 24, 2023
1 check passed
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.

3 participants