Skip to content

Commit 1c9864e

Browse files
committed
Ignore IllegalStateException from Runtime#removeShutdownHook
1 parent b58297e commit 1c9864e

File tree

1 file changed

+5
-1
lines changed
  • src/main/kotlin/io/github/freya022/botcommands/internal/core/service

1 file changed

+5
-1
lines changed

src/main/kotlin/io/github/freya022/botcommands/internal/core/service/BCShutdownHook.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ internal class BCShutdownHook internal constructor(
3131
@BEventListener
3232
internal fun onShuttingDown(event: BStatusChangeEvent) {
3333
if (event.newStatus == BContext.Status.SHUTTING_DOWN) {
34-
Runtime.getRuntime().removeShutdownHook(hook)
34+
try {
35+
Runtime.getRuntime().removeShutdownHook(hook)
36+
} catch (_: IllegalStateException) {
37+
//
38+
}
3539
}
3640
}
3741

0 commit comments

Comments
 (0)