CodeChicken Lib 1.8.+

CodeChicken Lib 1.8.+

141M Downloads

NPE on startup if mods/1.10.2 is a file, not a folder

RagingCactus opened this issue ยท 0 comments

commented

Somehow I managed to create an empty file called '1.10.2' in my mods folder when upgrading my DW20 server. CCL crashes on startup. Important part of FML log:

[14:08:59] [main/ERROR] [LaunchWrapper/]: Unable to launch
java.lang.RuntimeException: java.lang.NullPointerException
    at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:168) ~[FTBserver-1.10.2-12.18.3.2185-universal.jar:?]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_102]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_102]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_102]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_102]
    at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:62) [FTBserver-1.10.2-12.18.3.2185-universal.jar:?]
    at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:31) [FTBserver-1.10.2-12.18.3.2185-universal.jar:?]
Caused by: java.lang.NullPointerException
    at codechicken.lib.asm.CCLCorePlugin.scanMods(CCLCorePlugin.java:63) ~[CodeChickenLib-1.10.2-2.5.0.178-universal.jar:?]
    at codechicken.lib.asm.CCLCorePlugin.call(CCLCorePlugin.java:51) ~[CodeChickenLib-1.10.2-2.5.0.178-universal.jar:?]
    at codechicken.lib.asm.CCLCorePlugin.call(CCLCorePlugin.java:19) ~[CodeChickenLib-1.10.2-2.5.0.178-universal.jar:?]
    at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:164) ~[FTBserver-1.10.2-12.18.3.2185-universal.jar:?]
    ... 8 more

NPE on line 63 here

for (File file : versionModsDir.listFiles()) {

versionModsDir.listFiles() returns null because versionModsDir was not a directory in my case.
I acknowledge that this was a derp on my part, but I think it wouldn't hurt to not NPE here. I still would have no clue why this happened if the mod wasn't open surce. Maybe change line 62 to

if (versionModsDir.exists() && versionModsDir.isDirectory()) {

I don't want to PR this because I've never worked with MC mod sources at all...