Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 88f6caa

Browse files
committed
Fixed NullPointerException
Closes #34 Signed-off-by: DeathsGun <deathsgun@protonmail.com>
1 parent 6db4a69 commit 88f6caa

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/xyz/deathsgun/modmanager/util/FabricMods.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.gson.Gson;
2020
import net.fabricmc.loader.api.FabricLoader;
2121
import net.fabricmc.loader.api.ModContainer;
22+
import org.apache.logging.log4j.LogManager;
2223
import xyz.deathsgun.modmanager.api.mod.SummarizedMod;
2324
import xyz.deathsgun.modmanager.model.ReducedModMetadata;
2425

@@ -47,6 +48,10 @@ public static Path getJarFromModContainer(String id, String name) throws Excepti
4748
for (Path path : jars) {
4849
ZipFile zipFile = new ZipFile(path.toFile());
4950
ZipEntry entry = zipFile.getEntry("fabric.mod.json");
51+
if (entry == null) {
52+
LogManager.getLogger().warn("No fabric.mod.json found in {}", path);
53+
continue;
54+
}
5055
ReducedModMetadata metadata = gson.fromJson(new InputStreamReader(zipFile.getInputStream(entry)), ReducedModMetadata.class);
5156
zipFile.close();
5257
if (metadata.getId().equals(id) || metadata.getName().equals(name)) {

0 commit comments

Comments
 (0)