diff --git a/tg/action.go b/tg/action.go index bc67b26..829744d 100644 --- a/tg/action.go +++ b/tg/action.go @@ -23,7 +23,7 @@ func newAction(a Action) *action { } func (a *action) Act(c *Context) { - if a.Action != nil { + if a != nil && a.Action != nil { a.Action.Act(c) } } diff --git a/tg/command.go b/tg/command.go index 3d573b5..1ba5ce1 100644 --- a/tg/command.go +++ b/tg/command.go @@ -171,7 +171,8 @@ func (widget *CommandWidget) Serve(c *Context, updates chan *Update) error { if !ok { c.Run(widget.Usage, u) continue - } + } + c.Run(cmd.Action, u) if cmd.Widget != nil { if cmdUpdates != nil { @@ -187,6 +188,7 @@ func (widget *CommandWidget) Serve(c *Context, updates chan *Update) error { cmdUpdates = nil }() } + continue } if cmdUpdates != nil {