Skip to content

Commit

Permalink
Rebased upstream - Fixed NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
corruptmemory committed Nov 18, 2019
1 parent 5dafdb1 commit 615e70e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *Context) Lineage() []*Context {
return lineage
}

// value returns the value of the flag corresponding to `name`
// Value returns the value of the flag corresponding to `name`
func (c *Context) Value(name string) interface{} {
return c.flagSet.Lookup(name).Value.(flag.Getter).Get()
}
Expand Down
4 changes: 2 additions & 2 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cli
import (
"context"
"flag"
"sort"
"os"
"sort"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -328,7 +328,7 @@ func TestContextPropagation(t *testing.T) {
parent := NewContext(nil, nil, nil)
parent.Context = context.WithValue(context.Background(), "key", "val")
ctx := NewContext(nil, nil, parent)
val := ctx.Value("key")
val := ctx.Context.Value("key")
if val == nil {
t.Fatal("expected a parent context to be inherited but got nil")
}
Expand Down

0 comments on commit 615e70e

Please sign in to comment.