From 7973984227a158cf325cd4d8be177800297e1d92 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 6 Apr 2016 02:11:27 -0700 Subject: [PATCH] Fixed NPE in dedicated server languages. And fixed logger for main FML event bus. --- .../fml/common/LoadController.java | 19 +++++++++++++------ .../fml/server/FMLServerHandler.java | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/LoadController.java b/src/main/java/net/minecraftforge/fml/common/LoadController.java index ec990c52e..8f2f16055 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoadController.java +++ b/src/main/java/net/minecraftforge/fml/common/LoadController.java @@ -63,7 +63,14 @@ public class LoadController public LoadController(Loader loader) { this.loader = loader; - this.masterChannel = new EventBus("FMLMainChannel"); + this.masterChannel = new EventBus(new SubscriberExceptionHandler() + { + @Override + public void handleException(Throwable exception, SubscriberExceptionContext context) + { + FMLLog.log("FMLMainChannel", Level.ERROR, exception, "Could not dispatch event: %s to %s", context.getEvent(), context.getSubscriberMethod()); + } + }); this.masterChannel.register(this); state = LoaderState.NOINIT; @@ -159,8 +166,8 @@ public class LoadController else { FMLLog.severe("The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base class" + - "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + - "ForgeModLoader, especially Optifine, to see if there are fixes available."); + "ForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside of" + + "ForgeModLoader, especially Optifine, to see if there are fixes available."); throw new RuntimeException("The ForgeModLoader state engine is invalid"); } if (toThrow != null && toThrow instanceof RuntimeException) @@ -327,9 +334,9 @@ public class LoadController return this.state == state; } - boolean hasReachedState(LoaderState state) { - return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED; - } + boolean hasReachedState(LoaderState state) { + return this.state.ordinal()>=state.ordinal() && this.state!=LoaderState.ERRORED; + } void forceState(LoaderState newState) { diff --git a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java index 56df1ff8a..f9e7db1d6 100644 --- a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java +++ b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java @@ -256,7 +256,8 @@ public class FMLServerHandler implements IFMLSidedHandler IOUtils.closeQuietly(stream); try { - zip.close(); + if (zip != null) + zip.close(); } catch (IOException e) {