From a6afd9540c152c097727f4f332cbdf6e1d5ee08d Mon Sep 17 00:00:00 2001 From: NoMathExpectation <85624722+NoMathExpectation@users.noreply.github.com> Date: Fri, 24 Feb 2023 10:15:43 +0800 Subject: [PATCH] [console] Fixed reaching UNREACHABLE_CLAUSE when running extensions with non-null function results. (#2528) --- .../src/command/resolve/CommandCallInterceptor.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mirai-console/backend/mirai-console/src/command/resolve/CommandCallInterceptor.kt b/mirai-console/backend/mirai-console/src/command/resolve/CommandCallInterceptor.kt index 845e3503d..4c2a534ff 100644 --- a/mirai-console/backend/mirai-console/src/command/resolve/CommandCallInterceptor.kt +++ b/mirai-console/backend/mirai-console/src/command/resolve/CommandCallInterceptor.kt @@ -147,8 +147,8 @@ public inline fun InterceptResult.fold( callsInPlace(onIntercepted, InvocationKind.AT_MOST_ONCE) callsInPlace(otherwise, InvocationKind.AT_MOST_ONCE) } - value?.let(otherwise) - reason?.let(onIntercepted) + value?.let { return otherwise(it) } + reason?.let { return onIntercepted(it) } UNREACHABLE_CLAUSE }