Fix NullPointerException crash in PipeFlowFluids#4656
Fix NullPointerException crash in PipeFlowFluids#4656AlexIIL merged 2 commits intoBuildCraft:8.0.xfrom anonyco:patch-1
Conversation
FIXES a bug where accesing lastSentDirection.nbtValue throws a NullPointerException when placing a wooden fluid pipe next to a Magneticraft Infinite Water block and then breaking wooden fluid pipe. To the best of my Java ability I couldn't figure out why :(
|
Thanks for the bug report - sadly my lack of javadocs didn't help much, but So the real fix for this is to delete these two lines: https://github.com/BuildCraft/BuildCraft/blob/8.0.x/common/buildcraft/transport/pipe/flow/PipeFlowFluids.java#L815 and https://github.com/BuildCraft/BuildCraft/blob/8.0.x/common/buildcraft/transport/pipe/flow/PipeFlowFluids.java#L826 |
|
I have fixed my PR so that it now removes those two lines as you suggested. Also, after looking at it with a fresh set of eyes, I realized the reason why it was throwing an error:
Note that I work mostly in C/C++ and dream in Lisp, so please be patient as I try to comprehend the intricacies of Java lol. Keep up the great work 👍 |
|
You're nearly correct - with one exception: you can only get a NullPointerException when dereferencing a value with null - which only happens when you use |
|
Basically this looks good now, thanks! |
Thank you for taking the time to explain this to me. I learn something new about Java every day lol. |
FIXES a bug where accesing lastSentDirection.nbtValue throws a NullPointerException when placing a wooden fluid pipe next to a Magneticraft Infinite Water block and then breaking wooden fluid pipe. To the best of my Java ability I couldn't figure out why :(