Replace all references of blockType with getBlockType to fix NPE #41
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.
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.