Fixed some CommandWidget bugs related to transmitting unneeded updates further.

This commit is contained in:
Andrey Parhomenko 2023-09-12 11:41:50 +03:00
parent 1d543bf444
commit d500d84de6
2 changed files with 4 additions and 2 deletions

View file

@ -23,7 +23,7 @@ func newAction(a Action) *action {
} }
func (a *action) Act(c *Context) { func (a *action) Act(c *Context) {
if a.Action != nil { if a != nil && a.Action != nil {
a.Action.Act(c) a.Action.Act(c)
} }
} }

View file

@ -172,6 +172,7 @@ func (widget *CommandWidget) Serve(c *Context, updates chan *Update) error {
c.Run(widget.Usage, u) c.Run(widget.Usage, u)
continue continue
} }
c.Run(cmd.Action, u) c.Run(cmd.Action, u)
if cmd.Widget != nil { if cmd.Widget != nil {
if cmdUpdates != nil { if cmdUpdates != nil {
@ -187,6 +188,7 @@ func (widget *CommandWidget) Serve(c *Context, updates chan *Update) error {
cmdUpdates = nil cmdUpdates = nil
}() }()
} }
continue
} }
if cmdUpdates != nil { if cmdUpdates != nil {