aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-04 22:56:42 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-04 22:56:42 +0200
commit37d108006d213038a3d99af1c9487d53e31b925a (patch)
treea69a9309305ff39309e0629b7a1ccbae576e27ba /src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
parent0cd9274e0fefb8c89b11219f3b96d3b873a090f7 (diff)
downloadskyhanni-37d108006d213038a3d99af1c9487d53e31b925a.tar.gz
skyhanni-37d108006d213038a3d99af1c9487d53e31b925a.tar.bz2
skyhanni-37d108006d213038a3d99af1c9487d53e31b925a.zip
added debugs instead of throwing errors
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