Skip to content

[BUG] Server crash: NPE in LibVulpes TileFluidHatch.drain when AE2 Fluid Storage Bus updates #78

Description

@UraraChiya

Version of Advanced Rocketry

2.2.14

Have you verified this is an issue in the latest unstable build

  • [] Y
  • N
  • [] N/A

Version of LibVulpes

0.5.7

Version of Minecraft

1.12.2

Does this occur without other mods installed

  • [] Y
  • N
  • [] N/A

If Y, what is the MINIMUM set of mods required.

Crash report or log or visualVM (if applicable)

https://mclo.gs/bEQg12L

Description of the problem

The dedicated server crashes during the server tick loop with a NullPointerException in LibVulpes:

Cannot invoke "net.minecraftforge.fluids.FluidStack.isFluidEqual(net.minecraftforge.fluids.FluidStack)" because "resource" is null

Stack trace points to:

zmaster587.libVulpes.tile.multiblock.hatch.TileFluidHatch.drain(TileFluidHatch.java:114)
zmaster587.libVulpes.cap.FluidCapability.drain(FluidCapability.java:27)
appeng.fluids.parts.FluidHandlerAdapter$InventoryCache.update(FluidHandlerAdapter.java:198)
appeng.fluids.parts.PartFluidStorageBus.getInventoryWrapper(PartFluidStorageBus.java:372)
appeng.fluids.parts.PartFluidStorageBus.getInternalHandler(PartFluidStorageBus.java:421)
appeng.fluids.parts.PartFluidStorageBus.getCellArray(PartFluidStorageBus.java:491)
appeng.me.cache.GridStorageCache.addCellProvider(GridStorageCache.java:153)
appeng.me.cache.GridStorageCache.cellUpdate(GridStorageCache.java:205)

It appears that AE2's fluid storage bus is updating/scanning the LibVulpes fluid hatch and calls drain with a null FluidStack resource. Per Forge's IFluidHandler, drain(null, ...) is a valid way to query/drain any fluid. TileFluidHatch.drain does not handle a null resource and calls resource.isFluidEqual(...), causing the server crash.

Reproduction

  1. Use Minecraft 1.12.2 with Advanced Rocketry 2.2.14 and LibVulpes 0.5.7.
  2. Have Applied Energistics 2 / AE2 fluid integration installed, e.g. AE2 UEL v0.56.7 with fluid storage bus support.
  3. Place an Advanced Rocketry / LibVulpes multiblock fluid hatch.
  4. Connect an AE2 fluid storage bus to the fluid hatch.
  5. Power/update the ME network, or let the network update the storage bus.
  6. The server crashes in the tick loop with the above NPE.

Expected behavior

TileFluidHatch.drain should handle a null FluidStack resource safely, as expected by Forge's fluid handler API, or at least not crash the server.

Actual behavior

Server crashes due to NullPointerException in TileFluidHatch.drain.

Additional environment

  • Modpack: Enigmatica 2- Expert - Extended, Version 1.87.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions