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

Commit e284bf2

Browse files
committed
Fix compatibility with Essential
Move the try-catch into the for loop Closes #84 Signed-off-by: DeathsGun <deathsgun@protonmail.com>
1 parent 1e23e96 commit e284bf2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/kotlin/xyz/deathsgun/modmanager/update/UpdateManager.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,23 +318,24 @@ class UpdateManager {
318318

319319
private val json = Json {
320320
ignoreUnknownKeys = true
321+
encodeDefaults = true
321322
}
322323

323324
@OptIn(ExperimentalSerializationApi::class)
324325
fun findJarByModContainer(container: ModMetadata): Path? {
325326
val jars =
326327
FileUtils.listFiles(FabricLoader.getInstance().gameDir.resolve("mods").toFile(), arrayOf("jar"), true)
327-
return try {
328-
for (jar in jars) {
328+
for (jar in jars) {
329+
try {
329330
val meta = openFabricMeta(jar)
330331
if (meta.id == container.id) {
331332
return jar.toPath()
332333
}
334+
} catch (e: Exception) {
335+
continue
333336
}
334-
null
335-
} catch (e: Exception) {
336-
null
337337
}
338+
return null
338339
}
339340

340341
private fun findJarByMod(mod: Mod): Path? {

0 commit comments

Comments
 (0)