Closed soir20 closed 1 month ago
I'm curious to see how you're listing those resources, in theory NPE should never be thrown if resources are interacted with correctly.
My mod adds a resource pack that scans other packs for certain resources. I streamResourcePacks()
from the ResourceManager
and query resources from them directly to prevent infinite recursion and to query root resources.
Specifically, I was calling listResources()
directly on the resource packs, rather than going through the ResourceManager
. This has since been fixed to check that the pack has the given namespace, so there's no longer a crash. However, I don't think Quilt should crash in these circumstances because vanilla packs do not; there should at least be a descriptive exception if this is intended.
Currently, two methods in
GroupResourcePack
will throwNullPointerException
s if there is no pack for the given namespace. I've tweaked these methods so that theGroupResourcePack
won't crash the game in these circumstances.This isn't an issue when no other mods are present because vanilla also scans packs by namespace. However, I develop a mod that originally listed resources in all packs, regardless of whether they contained a particular namespace, which caused the game to crash.
There's an existing null check in
open()
; this PR makes null handling consistent throughout the wholeGroupResourcePack
.