Merge pull request #527 from urfave/dereference-flag-pointers

Dereference `Flag`s if they are pointers
This commit is contained in:
Dan Buch 2016-09-11 11:42:40 -04:00 committed by GitHub
commit bf7166a9d7

View File

@ -79,7 +79,12 @@ func (c *Context) IsSet(name string) bool {
return
}
envVarValue := reflect.ValueOf(f).FieldByName("EnvVar")
val := reflect.ValueOf(f)
if val.Kind() == reflect.Ptr {
val = val.Elem()
}
envVarValue := val.FieldByName("EnvVar")
if !envVarValue.IsValid() {
return
}