✏️ 修复 control 找不到服务时 panic (#81)

This commit is contained in:
fumiama 2021-11-27 01:10:51 +08:00
parent f8ca9355d2
commit d8a41a5ee1

View File

@ -177,6 +177,7 @@ func init() {
service, ok := Lookup(model.Args) service, ok := Lookup(model.Args)
if !ok { if !ok {
ctx.SendChain(message.Text("没有找到指定服务!")) ctx.SendChain(message.Text("没有找到指定服务!"))
return
} }
grp := ctx.Event.GroupID grp := ctx.Event.GroupID
if grp == 0 { if grp == 0 {
@ -201,6 +202,7 @@ func init() {
service, ok := Lookup(model.Args) service, ok := Lookup(model.Args)
if !ok { if !ok {
ctx.SendChain(message.Text("没有找到指定服务!")) ctx.SendChain(message.Text("没有找到指定服务!"))
return
} }
grp := ctx.Event.GroupID grp := ctx.Event.GroupID
if grp == 0 { if grp == 0 {
@ -218,6 +220,7 @@ func init() {
service, ok := Lookup(model.Args) service, ok := Lookup(model.Args)
if !ok { if !ok {
ctx.SendChain(message.Text("没有找到指定服务!")) ctx.SendChain(message.Text("没有找到指定服务!"))
return
} }
if service.options.Help != "" { if service.options.Help != "" {
ctx.SendChain(message.Text(service.options.Help)) ctx.SendChain(message.Text(service.options.Help))