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

Transformation NPE crash #158

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MetaflameDragon
Copy link

Fixes #102

The crash is caused by multiple transformers fighting over inputStack. The first one sets the tank contents to null, and every subsequent container takes that null value and assigns it to inputStack. This writes it to NBT and causes NPEs later on during render and update.

(Note: compilation was not tested as I couldn't set up the toolchain properly, but it is verified by editing and patching the bytecode of the compiled mod.)

… null, and causing a NPE later on

Whenever two (or more) transformers would fulfil their conditions at once, the first one would correctly pass the tank's fluid over to inputStack and remove the fluid, but the second transformer would retrieve the null fluid and assign it to inputStack.
This would set the NBT data to null, causing a NPE both in the barrel's render method due to a null stack, and in the update method due to passing null to the transformer.
This previously caused a crash when stack itself was null, and now defaults to a missing sprite
This previously caused a crash when inputStack was null. The method now checks for both, but remains lenient if transformer is already set.
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.

Crash when fluid in barrel tries to transform to multiple different fluids.
1 participant