mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 14:50:43 +08:00
[console] 修复在Android系统运行时,被杀后台时抛出的 InterruptedException 导致崩溃 (#2474)
* 修复在Android系统运行时,被杀后台时抛出的 InterruptedException 导致崩溃 * Update mirai-console/backend/mirai-console/src/MiraiConsoleImplementation.kt Co-authored-by: Him188 <Him188@mamoe.net> --------- Co-authored-by: Him188 <Him188@mamoe.net>
This commit is contained in:
parent
a6afd9540c
commit
cb78ed34a5
@ -449,9 +449,13 @@ public interface MiraiConsoleImplementation : CoroutineScope {
|
|||||||
init {
|
init {
|
||||||
Runtime.getRuntime().addShutdownHook(thread(false, name = "Mirai Console Shutdown Hook") {
|
Runtime.getRuntime().addShutdownHook(thread(false, name = "Mirai Console Shutdown Hook") {
|
||||||
if (instanceInitialized) {
|
if (instanceInitialized) {
|
||||||
|
try {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
shutdown()
|
shutdown()
|
||||||
}
|
}
|
||||||
|
} catch (_ : InterruptedException) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user