From bf4682260dcaf9937a917639a0fdbb9d80003462 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sun, 12 Jun 2022 13:48:20 -0500 Subject: [PATCH] close #114 --- .../common/casting/operators/stack/OpFisherman.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt index 6804ebe92..4974a9d6d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt @@ -13,9 +13,14 @@ import kotlin.math.abs import kotlin.math.roundToInt object OpFisherman : Operator { - override fun operate(continuation: SpellContinuation, stack: MutableList>, local: SpellDatum<*>, ctx: CastingContext): OperationResult { - if (stack.isEmpty()) - throw MishapNotEnoughArgs(1, 0) + override fun operate( + continuation: SpellContinuation, + stack: MutableList>, + local: SpellDatum<*>, + ctx: CastingContext + ): OperationResult { + if (stack.size < 2) + throw MishapNotEnoughArgs(2, 0) val arg = stack.getChecked(stack.lastIndex) val datum = stack[stack.lastIndex] val distance = stack.size - (arg + 1) // because getChecked just gives me a double for some reason