preprocessor icon indicating copy to clipboard operation
preprocessor copied to clipboard

Having a `mainProject` file with contents that are not a project's name causes an NPE

Open caoimhebyrne opened this issue 10 months ago • 0 comments

If mainProject contains anything except the name of a project included, an ambiguous NPE will be thrown.

An exception occurred applying plugin request [id: 'gg.essential.multi-version']
> Failed to apply plugin class 'com.replaymod.gradle.preprocess.PreprocessPlugin'.
   > java.lang.NullPointerException (no error message)

* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'gg.essential.multi-version']
...
Caused by: java.lang.NullPointerException
	at com.replaymod.gradle.preprocess.PreprocessPlugin.apply(PreprocessPlugin.kt:63)
	at com.replaymod.gradle.preprocess.PreprocessPlugin.apply(PreprocessPlugin.kt:29)

It took me a while to figure out where I was going wrong, until I double-checked my mainProject file and realized it was incorrect. A check would probably belong somewhere around where the mainProject file is read (even if this is not implemented, having this issue around would probably help others that frequently mistype like myself)

https://github.com/ReplayMod/preprocessor/blob/7c980d91ab7d6b7d7118d48c23de7c438bd87747/src/main/kotlin/com/replaymod/gradle/preprocess/PreprocessPlugin.kt#L42-L63

caoimhebyrne avatar Mar 19 '25 22:03 caoimhebyrne