CustomItems NullPointer in BlockDropHandler

Issue #21 resolved
Former user created an issue

Shortly after loading the Nether dimension, game crashes with an NPE in BlockDropHandler when NetherOres is installed.

Does not happen when logging in while in the Nether - only when loading it when traveling through a portal.

It looks like it's possible for either GameRegistry.findUniqueIdentifierFor(block) to return null or for the event passed to the handler to be null.

In either case, a simple null check in BlockDropHandler on line 46 should resolve the problem.

[02:36:40] [Server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking entity at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:642) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:111) ~[bsx.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [?:?] Caused by: java.lang.NullPointerException at me.otho.customItems.mod.handler.BlockDropHandler.onBlockDrop(BlockDropHandler.java:46) ~[BlockDropHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_314_BlockDropHandler_onBlockDrop_HarvestDropsEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?] at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:155) ~[ForgeEventFactory.class:?] at net.minecraft.block.Block.func_149690_a(Block.java:656) ~[aji.class:?] at net.minecraft.world.Explosion.func_77279_a(Explosion.java:212) ~[agw.class:?] at net.minecraft.world.WorldServer.func_72885_a(WorldServer.java:902) ~[mt.class:?] at powercrystals.netherores.entity.EntityArmedOre.explode(EntityArmedOre.java:92) ~[EntityArmedOre.class:?] at powercrystals.netherores.entity.EntityArmedOre.func_70071_h_(EntityArmedOre.java:72) ~[EntityArmedOre.class:?] at net.minecraft.world.World.func_72866_a(World.java:2070) ~[ahb.class:?] at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:648) ~[mt.class:?] at net.minecraft.world.World.func_72870_g(World.java:2034) ~[ahb.class:?] at net.minecraft.world.World.func_72939_s(World.java:1887) ~[ahb.class:?] at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:489) ~[mt.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:636) ~[MinecraftServer.class:?] ... 4 more

Comments (2)

  1. Log in to comment