From 410e6651401b55aa581f5e82ad287cba7826787b Mon Sep 17 00:00:00 2001 From: deirn Date: Fri, 6 Aug 2021 16:16:42 +0700 Subject: [PATCH] fix #99 crash --- .../badasintended/slotlink/screen/RequestScreenHandler.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/badasintended/slotlink/screen/RequestScreenHandler.kt b/src/main/kotlin/badasintended/slotlink/screen/RequestScreenHandler.kt index fce9927..b711f50 100644 --- a/src/main/kotlin/badasintended/slotlink/screen/RequestScreenHandler.kt +++ b/src/main/kotlin/badasintended/slotlink/screen/RequestScreenHandler.kt @@ -510,9 +510,11 @@ open class RequestScreenHandler( resort = true view.update(stack) } else if (view.count != stack.count) { - val filled = filledStacks.first { view.isItemAndTagEqual(it) } - filled.count -= view.count - stack.count - view.update(stack) + val filled = filledStacks.firstOrNull { view.isItemAndTagEqual(it) } + if (filled != null) { + filled.count -= view.count - stack.count + view.update(stack) + } } } }