From 1e0e23fe4957020e3a5615f6d942162ed67d552b Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Fri, 12 Oct 2012 17:36:08 -0700 Subject: [PATCH] Add some null checking to the pipe GUIs Fixes #345 --- common/buildcraft/transport/GuiHandler.java | 40 +++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/common/buildcraft/transport/GuiHandler.java b/common/buildcraft/transport/GuiHandler.java index 29c99b18..a3fd8edc 100644 --- a/common/buildcraft/transport/GuiHandler.java +++ b/common/buildcraft/transport/GuiHandler.java @@ -25,16 +25,18 @@ public class GuiHandler implements IGuiHandler { TileGenericPipe pipe = (TileGenericPipe) tile; - switch (ID) { - - case GuiIds.PIPE_DIAMOND: - return new ContainerDiamondPipe(player.inventory, (PipeLogicDiamond)pipe.pipe.logic); - - case GuiIds.GATES: - return new ContainerGateInterface(player.inventory, pipe.pipe); - - default: + if (pipe.pipe == null) return null; + + switch (ID) { + case GuiIds.PIPE_DIAMOND: + return new ContainerDiamondPipe(player.inventory, (PipeLogicDiamond)pipe.pipe.logic); + + case GuiIds.GATES: + return new ContainerGateInterface(player.inventory, pipe.pipe); + + default: + return null; } } @@ -49,16 +51,18 @@ public class GuiHandler implements IGuiHandler { TileGenericPipe pipe = (TileGenericPipe) tile; - switch (ID) { - - case GuiIds.PIPE_DIAMOND: - return new GuiDiamondPipe(player.inventory, pipe); - - case GuiIds.GATES: - return new GuiGateInterface(player.inventory, pipe.pipe); - - default: + if (pipe.pipe == null) return null; + + switch (ID) { + case GuiIds.PIPE_DIAMOND: + return new GuiDiamondPipe(player.inventory, pipe); + + case GuiIds.GATES: + return new GuiGateInterface(player.inventory, pipe.pipe); + + default: + return null; } } }