From 807df3bbcd3e82d921a036cd49ec8888f1b193b7 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 12 Sep 2020 21:22:47 +0800 Subject: [PATCH] Check PluginDependency.id on init --- .../mirai/console/plugin/description/PluginDependency.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/PluginDependency.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/PluginDependency.kt index 957a14bf7..e62ba0482 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/PluginDependency.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/description/PluginDependency.kt @@ -36,6 +36,14 @@ public data class PluginDependency @JvmOverloads constructor( */ public val isOptional: Boolean = false ) { + init { + kotlin.runCatching { + PluginDescription.checkPluginId(id) + }.getOrElse { + throw IllegalArgumentException(it) + } + } + /** * @see PluginDependency */