Skip to content

Conversation

John200410
Copy link

When fabric.debug.logClassLoad is set to true, it is possible for an exception to be thrown during the logging which causes the game to crash and the log message to never be printed.

In KnotClassDelegate#getRawClassByteArray, ClassLoader#getResource is used to get a URL instance. ClassLoader#getResource is nullable, meaning it's possible for the url variable to be null.
It is expected that this can be null, thats why there is a check to the isValidParentUrl method.

But if fabric.debug.logClassLoad is enabled, it attempts to log a message and passes the potentially null variable to the getCodeSource method, which throws an exception if url is null:

net.fabricmc.loader.impl.util.ExceptionUtil$WrappedException: net.fabricmc.loader.impl.util.UrlConversionException: java.lang.NullPointerException: Cannot invoke "java.net.URL.openConnection()" because "url" is null
	at net.fabricmc.loader.impl.util.ExceptionUtil.wrap(ExceptionUtil.java:51)
	at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getCodeSource(KnotClassDelegate.java:530)
	at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getRawClassByteArray(KnotClassDelegate.java:502)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants