aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
index 733e8709f..e78457cb2 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
@@ -120,8 +120,13 @@ class CollectionAPI {
// TODO add support for replenish (higher collection than actual items in inv)
fun addFromInventory(internalName: String, amount: Int) {
- val name = NEUItems.getItemStack(internalName).name?.removeColor() ?: return
+ val stack = NEUItems.getItemStackOrNull(internalName)
+ if (stack == null) {
+ LorenzUtils.debug("CollectionAPI.addFromInventory internalName '$internalName' is null!")
+ return
+ }
+ val name = stack.name!!.removeColor()
val oldValue = collectionValue[name] ?: return
val newValue = oldValue + amount