-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing null handling to GroupResourcePack
#342
Conversation
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 Specifically, I was calling |
...ore/resource_loader/src/main/java/org/quiltmc/qsl/resource/loader/api/GroupResourcePack.java
Outdated
Show resolved
Hide resolved
// Iterating backwards as higher-priority packs are placed at the end. | ||
for (var pack : packs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment actually relevant ? It seems copy-pasted from above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same for
statement, just moved under the null
check, so the comment is still relevant.
"Merged" with 50309c1 |
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
.