Forestry

Forestry

65M Downloads

[1.12.2] Random chance of crashing on world load

thedarkcolour opened this issue ยท 0 comments

commented

When loading worlds, there is a small chance the game will crash on this code in PacketHandler.java because the player is still null:

private static void checkThreadAndEnqueue(final IForestryPacketHandlerClient packet, final PacketBufferForestry data, IThreadListener threadListener) {
	if (!threadListener.isCallingFromMinecraftThread()) {
		data.retain();
		threadListener.addScheduledTask(() -> {
			try {
				EntityPlayer player = Minecraft.getMinecraft().player;
				Preconditions.checkNotNull(player, "Tried to send data to client before the player exists.");
				packet.onPacketData(data, player);
				data.release();
			} catch (IOException e) {
				Log.error("Network Error", e);
			}
		});
	}
}