aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-08-05 17:17:06 +0200
committerLinnea Gräf <nea@nea.moe>2025-08-05 17:17:06 +0200
commit2422c98cc5bc2c9e96d1da6b71f5bb1b75ae3d69 (patch)
tree63220d5f8900d9dceaf3ad990f5903542063567b /src
parentf5cbbcb1514f97dfd422f2da6184d21e9f0af16a (diff)
downloadFirmament-2422c98cc5bc2c9e96d1da6b71f5bb1b75ae3d69.tar.gz
Firmament-2422c98cc5bc2c9e96d1da6b71f5bb1b75ae3d69.tar.bz2
Firmament-2422c98cc5bc2c9e96d1da6b71f5bb1b75ae3d69.zip
fix: Don't export null items without internal name
Diffstat (limited to 'src')
-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()) {