Some null safety (fixes #24)

This commit is contained in:
Johannes Frohnmeyer 2022-08-31 17:20:31 +02:00
parent 2225ad73ce
commit 5077197fe0
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 6 additions and 2 deletions

View File

@ -45,8 +45,12 @@ public class ResourcePackManagerMixin {
private void rpo$checkProfile(String profileName, String displayName, ResourcePack rpi, Set<Path> toRemove) {
Path dataLocation = null;
if (rpi instanceof AbstractFileResourcePack arr) {
Path pack = arr.getBase().toPath();
dataLocation = pack.getParent().resolve(pack.getFileName().toString() + Respackopts.FILE_EXTENSION);
File pack = arr.getBase();
if (pack != null) {
dataLocation = pack.toPath().getParent().resolve(pack.getName() + Respackopts.FILE_EXTENSION);
} else {
Respackopts.LOGGER.warn("Base path of abstract file resource pack " + arr.getName() + " is null. This shouldn't happen!");
}
}
try (InputStream is = rpi.openRoot(Respackopts.ID + ".json5")) {