MehVahdJukaar / Moonlight

GNU General Public License v3.0
53 stars 28 forks source link

[1.19.4] Fix NPE in `getRootResource()` when resource is not present #137

Closed soir20 closed 1 year ago

soir20 commented 1 year ago

Currently, a call to DynamicResourcePack#getRootResource() with the name of a resource that is not present throws a NullPointerException in the ByteArrayInputStream constructor, crashing the game. This PR adds a null check to avoid calling the ByteArrayInputStream constructor when the resource is null. getRootResource() is @Nullable, so it is safe to return null from this method when the resource is not present.

Please see MoreMcmeta/core#35 for logs and a stacktrace.