Prevent NPE in ConfigManager and fix config gui being enabled for all mods. Fixes #3856. (#3860)

This commit is contained in:
Justin 2017-04-27 19:02:50 -07:00 committed by LexManos
parent af2ca8e250
commit 460a2189d6
2 changed files with 11 additions and 2 deletions

View file

@ -202,7 +202,12 @@ public class ConfigManager
public static Class<?>[] getModConfigClasses(String modid)
{
return MOD_CONFIG_CLASSES.get(modid).toArray(new Class<?>[0]);
return (MOD_CONFIG_CLASSES.containsKey(modid) ? MOD_CONFIG_CLASSES.get(modid).toArray(new Class<?>[0]) : new Class<?>[0]);
}
public static boolean hasConfigForMod(String modid)
{
return asm_data.containsKey(modid);
}
// =======================================================

View file

@ -83,6 +83,7 @@ import net.minecraft.world.storage.SaveFormatOld;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.common.util.CompoundDataFixer;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.DummyModContainer;
@ -377,7 +378,10 @@ public class FMLClientHandler implements IFMLSidedHandler
String className = mc.getGuiClassName();
if (Strings.isNullOrEmpty(className))
{
guiFactories.put(mc, DefaultGuiFactory.forMod(mc));
if (ConfigManager.hasConfigForMod(mc.getModId()))
{
guiFactories.put(mc, DefaultGuiFactory.forMod(mc));
}
continue;
}
try