aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt
index 3a7c69be..675708e9 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/inventory/MuseumTooltipManager.kt
@@ -51,11 +51,15 @@ object MuseumTooltipManager {
private val loadedMuseumDataDelegate = lazy {
var data = MuseumData()
if (file.exists()) {
- val content = file.readText()
- val loadedData = Gson().fromJson(content, MuseumData::class.java)
- if (loadedData != null) {
- data = loadedData
- } else {
+ try {
+ val content = file.readText()
+ val loadedData = Gson().fromJson(content, MuseumData::class.java)
+ if (loadedData != null) {
+ data = loadedData
+ } else {
+ Utils.addChatMessage("${EnumChatFormatting.RED}${EnumChatFormatting.BOLD}[NEU] Error while reading existing museum data, resetting.")
+ }
+ } catch (ignored: Exception) {
Utils.addChatMessage("${EnumChatFormatting.RED}${EnumChatFormatting.BOLD}[NEU] Error while reading existing museum data, resetting.")
}
} else {