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) {
if a.Action != nil {
if a != nil && a.Action != nil {
a.Action.Act(c)
}
}

View file

@ -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 {