From c215069c005e7253b5ca42352fa74133174505fa Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Wed, 12 May 2021 01:17:05 +0800 Subject: [PATCH] fix(core): should support nested routers --- packages/koishi-core/src/context.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/koishi-core/src/context.ts b/packages/koishi-core/src/context.ts index 1f14f52a0c..1742776a3b 100644 --- a/packages/koishi-core/src/context.ts +++ b/packages/koishi-core/src/context.ts @@ -584,7 +584,7 @@ const register = Router.prototype.register Router.prototype.register = function (this: Router, ...args) { const layer = register.apply(this, args) const context: Context = this[Context.current] - context.state.disposables.push(() => { + context?.state.disposables.push(() => { remove(this.stack, layer) }) return layer