File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,9 @@ func (ctx *Context) lookupFlag(name string) Flag {
151151
152152func (ctx * Context ) lookupFlagSet (name string ) * flag.FlagSet {
153153 for _ , c := range ctx .Lineage () {
154+ if c .flagSet == nil {
155+ continue
156+ }
154157 if f := c .flagSet .Lookup (name ); f != nil {
155158 return c .flagSet
156159 }
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ func TestContext_String(t *testing.T) {
112112 c := NewContext (nil , set , parentCtx )
113113 expect (t , c .String ("myflag" ), "hello world" )
114114 expect (t , c .String ("top-flag" ), "hai veld" )
115+ c = NewContext (nil , nil , parentCtx )
116+ expect (t , c .String ("top-flag" ), "hai veld" )
115117}
116118
117119func TestContext_Path (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments