-
Notifications
You must be signed in to change notification settings - Fork 16
GetParentWorld is used after it is determined to be null #93
Description
public long getTotalWorldTime() {
if (this.getParentWorld() != null) {
return this.getParentWorld().getWorldInfo().getWorldTotalTime();
} else {
LoggerLittleBlocks.getInstance(Logger.filterClassName(this.getClass().toString())).write(this.getParentWorld().isRemote,
"getTotalWorldTime().[null]",
LoggerLittleBlocks.LogLevel.DEBUG);
return 0;
}
}
note: if you don't see it, you're testing if this.getParentWorld() is or is not null, then when it is null, you're calling write from a logger instance with the isRemote value of this.getParentWorld(), which has already been determined to be null, so it's looking for null.isRemote.
Attempting to use a value even though it's already determined as null? No wonder I've been having problems getting this mod to work! (every version I've tried for 1.7.x from the site and github)
This error was stumbled upon with the following crash report, LittleWorld.java line 255 is the code above
---- Minecraft Crash Report ----
// Sorry :(
Time: 11/6/14 2:52 PM
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at net.slimevoid.littleblocks.world.LittleWorld.func_82737_E(LittleWorld.java:255)
at net.slimevoid.littleblocks.world.LittleWorldClient.func_82737_E(LittleWorldClient.java:97)
at codechicken.multipart.TickScheduler$WorldTickScheduler.loadTag(TickScheduler.scala:108)
at codechicken.multipart.TickScheduler$WorldTickScheduler.load(TickScheduler.scala:100)
at codechicken.lib.world.WorldExtensionManager.onWorldLoad(WorldExtensionManager.java:165)
at codechicken.lib.world.WorldExtensionManager.access$100(WorldExtensionManager.java:22)
at codechicken.lib.world.WorldExtensionManager$WorldExtensionEventHandler.onWorldLoad(WorldExtensionManager.java:85)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_627_WorldExtensionEventHandler_onWorldLoad_Load.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.slimevoid.littleblocks.world.LittleWorldClient.(LittleWorldClient.java:44)
at net.slimevoid.littleblocks.client.events.WorldClientEvent.onWorldLoad(WorldClientEvent.java:25)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_543_WorldClientEvent_onWorldLoad_Load.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.minecraft.client.multiplayer.WorldClient.(WorldClient.java:61)
at net.minecraft.client.network.NetHandlerPlayClient.func_147282_a(NetHandlerPlayClient.java:237)
at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:70)
at net.minecraft.network.play.server.S01PacketJoinGame.func_148833_a(SourceFile:13)
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2050)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:962)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:887)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)