mekanism/Mekanism

[1.10] Look at a mechanical pipe with HWYLA, server log spammed with NPEs

Closed this issue · 3 comments

Up to date with branch 1.10 (commit 7e3c806). I just changed from WAILA to HWYLA and now when I look at a mechanical pipe full of water, my server log is spammed with the below stack trace.

[02:23:39] [Server thread/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_111]
        at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_111]
        at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?]
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:668) [MinecraftServer.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387) [ld.class:?]
        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.lang.NullPointerException
        at mekanism.common.multipart.PartSidedPipe.connectionMapContainsSide(PartSidedPipe.java:158) ~[PartSidedPipe.class:?]
        at mekanism.common.multipart.PartSidedPipe.getConnectionType(PartSidedPipe.java:740) ~[PartSidedPipe.class:?]
        at mekanism.common.multipart.PartSidedPipe.getConnectionType(PartSidedPipe.java:735) ~[PartSidedPipe.class:?]
        at mekanism.common.multipart.PartMechanicalPipe.getTankInfo(PartMechanicalPipe.java:259) ~[PartMechanicalPipe.class:?]
        at mekanism.common.base.FluidHandlerWrapper.getTankProperties(FluidHandlerWrapper.java:24) ~[FluidHandlerWrapper.class:?]
        at mcp.mobius.waila.addons.capability.HUDHandlerTank.getNBTData(HUDHandlerTank.java:60) ~[HUDHandlerTank.class:?]
        at mcp.mobius.waila.network.MessageRequestTile$Handler$1.run(MessageRequestTile.java:100) ~[MessageRequestTile$Handler$1.class:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_111]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_111]
        at net.minecraft.util.Util.func_181617_a(SourceFile:45) ~[h.class:?]
        ... 5 more

https://github.com/TehNut/HWYLA/blob/1.10/src/main/java/mcp/mobius/waila/addons/capability/HUDHandlerTank.java#L57

HWYLA passes a null as the side. This ends up creating a FluidHandlerWrapper which has a null side, and then you can follow the stack trace to see how the NPE ends up getting hit.

I think this needs to be fixed on the Mekanism side. The various entities should handle null to mean return information on all sides.

Would be appreciated if you can pull request your fix.

Fixed, thanks