Create new buffer if not present yet (#549)
Fixes a nil dereference when TraverseChildren is used with multiple subcommands.
This commit is contained in:
committed by
Albert Nigmatzianov
parent
7cd9cc6d44
commit
7b2c5ac9fc
@ -1360,6 +1360,9 @@ func (c *Command) ParseFlags(args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.flagErrorBuf == nil {
|
||||
c.flagErrorBuf = new(bytes.Buffer)
|
||||
}
|
||||
beforeErrorBufLen := c.flagErrorBuf.Len()
|
||||
c.mergePersistentFlags()
|
||||
err := c.Flags().Parse(args)
|
||||
|
Reference in New Issue
Block a user