From 7e94eb66d48661f7482a7b9686b1f4befd853ec7 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Thu, 20 May 2021 19:31:10 +0800 Subject: [PATCH] Fix StackOverflowError --- mirai-core/src/commonTest/kotlin/MockBot.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mirai-core/src/commonTest/kotlin/MockBot.kt b/mirai-core/src/commonTest/kotlin/MockBot.kt index cfa8bfbbf..d02877103 100644 --- a/mirai-core/src/commonTest/kotlin/MockBot.kt +++ b/mirai-core/src/commonTest/kotlin/MockBot.kt @@ -54,8 +54,9 @@ internal class MockBotBuilder( internal fun MockBot(conf: MockBotBuilder.() -> Unit = {}) = MockBotBuilder(MockConfiguration.copy()).apply(conf).run { object : QQAndroidBot(MockAccount, this.conf, debugConf) { - override val components: ComponentStorage = + override val components: ComponentStorage by lazy { componentsProvider?.invoke(this, this) ?: EMPTY_COMPONENT_STORAGE + } override fun createNetworkHandler(): NetworkHandler = nhProvider?.invoke(this, this) ?: super.createNetworkHandler()