Update BehaviourWithFSMStateHandlerHolder.kt

This commit is contained in:
InsanusMokrassar 2022-05-11 10:30:47 +06:00 committed by GitHub
parent d55d8fa000
commit 3e58114eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -34,10 +34,9 @@ class BehaviourWithFSMStateHandlerHolder<I : O, O : State>(
handleState(state as I)
}
override suspend fun StatesMachine<in O>.handleState(state: O): O? = if (this is BehaviourContextWithFSM) {
handleState(state)
} else {
null
override suspend fun StatesMachine<in O>.handleState(state: O): O? = with(delegateTo) {
@Suppress("UNCHECKED_CAST")
handleState(state as I)
}
}