diff --git a/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt b/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt index 47f9983b4..1bd732bd5 100644 --- a/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt +++ b/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt @@ -12,6 +12,6 @@ package net.mamoe.mirai import java.util.* internal actual fun findMiraiInstance(): Mirai { - return ServiceLoader.load(Mirai::class.java).findFirst() as Mirai? + return ServiceLoader.load(Mirai::class.java).findFirst().orElse(null) ?: Class.forName("net.mamoe.mirai.internal.MiraiImpl").kotlin.objectInstance as Mirai } \ No newline at end of file