fix nested conditions

This commit is contained in:
Sergey Goroshko 2020-05-31 20:52:18 +03:00
parent 196b222a8b
commit 10fe017765

View File

@ -117,11 +117,10 @@ func (f *StringSliceFlag) GetValue() string {
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *StringSliceFlag) Apply(set *flag.FlagSet) error { func (f *StringSliceFlag) Apply(set *flag.FlagSet) error {
if f.Destination != nil { if f.Destination != nil && f.Value != nil {
if f.Value != nil {
f.Destination.slice = make([]string, len(f.Value.slice)) f.Destination.slice = make([]string, len(f.Value.slice))
copy(f.Destination.slice, f.Value.slice) copy(f.Destination.slice, f.Value.slice)
}
} }
if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok { if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok {