diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt index 35d338f7f..6cf9bfd8d 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt @@ -7,6 +7,9 @@ private var isAddSuppressedSupported: Boolean = true @MiraiInternalAPI @Suppress("EXTENSION_SHADOWED_BY_MEMBER") actual fun Throwable.addSuppressed(e: Throwable) { + if (this === e) { + return + } if (!isAddSuppressedSupported) { return } diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt index b153e249b..dc3a97703 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/addSuppressed.kt @@ -5,6 +5,9 @@ private var isAddSuppressedSupported: Boolean = true @MiraiInternalAPI @Suppress("EXTENSION_SHADOWED_BY_MEMBER") actual fun Throwable.addSuppressed(e: Throwable) { + if (this === e) { + return + } if (!isAddSuppressedSupported) { return }