From 2422c98cc5bc2c9e96d1da6b71f5bb1b75ae3d69 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 5 Aug 2025 17:17:06 +0200 Subject: fix: Don't export null items without internal name --- src/main/kotlin/features/debug/itemeditor/ItemExporter.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') 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()) { -- cgit