Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 0846fe3

Browse files
authored
1.0.6' avoid crashing when failing to download mods list (#7)
1 parent f416d53 commit 0846fe3

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
ext.kotlin_version = "1.5.0"
99

10-
version = "1.0.5"
10+
version = "1.0.6"
1111
group = "mynameisjeff"
1212
archivesBaseName = "SkyblockClient-Updater"
1313

src/main/kotlin/mynameisjeff/skyblockclientupdater/SkyClientUpdater.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
1313
@Mod(modid = "skyblockclientupdater", name = "SkyClient Updater", version = SkyClientUpdater.VERSION, clientSideOnly = true, modLanguage = "kotlin", modLanguageAdapter = "mynameisjeff.skyblockclientupdater.utils.kotlin.KotlinAdapter")
1414
object SkyClientUpdater {
1515

16-
const val VERSION = "1.0.5"
16+
const val VERSION = "1.0.6"
1717

1818
@JvmField
1919
val mc = Minecraft.getMinecraft()
@@ -48,4 +48,4 @@ object SkyClientUpdater {
4848
}
4949
}
5050

51-
}
51+
}

src/main/kotlin/mynameisjeff/skyblockclientupdater/utils/UpdateChecker.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package mynameisjeff.skyblockclientupdater.utils
22

33
import com.google.gson.JsonParser
4+
import com.google.gson.JsonArray
45
import mynameisjeff.skyblockclientupdater.SkyClientUpdater
56
import mynameisjeff.skyblockclientupdater.SkyClientUpdater.mc
67
import mynameisjeff.skyblockclientupdater.gui.PromptUpdateScreen
@@ -108,7 +109,15 @@ object UpdateChecker {
108109
}
109110

110111
fun getLatestMods() {
111-
val mods = JsonParser().parse(WebUtils.fetchResponse("https://rawcdn.githack.com/nacrt/SkyblockClient-REPO/$latestCommitID/files/mods.json")).asJsonArray
112+
var mods = JsonArray()
113+
try {
114+
mods = JsonParser().parse(WebUtils.fetchResponse("https://rawcdn.githack.com/nacrt/SkyblockClient-REPO/$latestCommitID/files/mods.json")).asJsonArray
115+
}
116+
catch (ex: Throwable) {
117+
println("Failed to load mod files")
118+
ex.printStackTrace()
119+
}
120+
112121
for (m in mods) {
113122
val mod = m.asJsonObject
114123
val name = mod.get("file").asString

0 commit comments

Comments
 (0)