From 791e43819c2d5958023664569396f7148cb2a668 Mon Sep 17 00:00:00 2001
From: Karlatemp <karlatemp@vip.qq.com>
Date: Thu, 11 Feb 2021 07:47:14 +0800
Subject: [PATCH] Fix logic of BdhSessionSyncer.hasSession

---
 .../src/commonMain/kotlin/network/handler/BdhSessionSyncer.kt  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mirai-core/src/commonMain/kotlin/network/handler/BdhSessionSyncer.kt b/mirai-core/src/commonMain/kotlin/network/handler/BdhSessionSyncer.kt
index 49eaaa141..0f5c1d514 100644
--- a/mirai-core/src/commonMain/kotlin/network/handler/BdhSessionSyncer.kt
+++ b/mirai-core/src/commonMain/kotlin/network/handler/BdhSessionSyncer.kt
@@ -35,7 +35,8 @@ internal class BdhSessionSyncer(
     private val bot: QQAndroidBot
 ) {
     var bdhSession: CompletableDeferred<BdhSession> = CompletableDeferred()
-    val hasSession: Boolean get() = bdhSession.isCompleted
+    val hasSession: Boolean
+        get() = kotlin.runCatching { bdhSession.getCompleted() }.isSuccess
 
     fun overrideSession(
         session: BdhSession,