From 3e58114eeb0b16dd205810bf35aa629451d75bc7 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 11 May 2022 10:30:47 +0600 Subject: [PATCH] Update BehaviourWithFSMStateHandlerHolder.kt --- .../BehaviourWithFSMStateHandlerHolder.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder.kt b/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder.kt index 97d39c1a4e..50c68c1090 100644 --- a/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder.kt +++ b/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder.kt @@ -34,10 +34,9 @@ class BehaviourWithFSMStateHandlerHolder( handleState(state as I) } - override suspend fun StatesMachine.handleState(state: O): O? = if (this is BehaviourContextWithFSM) { - handleState(state) - } else { - null + override suspend fun StatesMachine.handleState(state: O): O? = with(delegateTo) { + @Suppress("UNCHECKED_CAST") + handleState(state as I) } }