aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/features/debug/itemeditor/ItemExporter.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt
index 2a56204..386a741 100644
--- a/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt
+++ b/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt
@@ -51,7 +51,10 @@ object ItemExporter {
nonOverlayCache.clear()
val exporter = LegacyItemExporter.createExporter(itemStack)
var json = exporter.exportJson()
- val fileName = json.jsonObject["internalname"]!!.jsonPrimitive.content
+ val fileName = json.jsonObject["internalname"]?.jsonPrimitive?.takeIf { it.isString }?.content
+ if (fileName == null) {
+ return tr("firmament.repoexport.nointernalname", "Could not find internal name to export for this item (null.json)")
+ }
val itemFile = RepoDownloadManager.repoSavedLocation.resolve("items").resolve("${fileName}.json")
itemFile.createParentDirectories()
if (itemFile.exists()) {