Fix panic if Valus in Int/StringSliceFlasg is missing

This commit is contained in:
Sergey Romanov
2015-06-01 01:50:23 +05:00
parent 942282e931
commit f47f7b7e85
2 changed files with 38 additions and 0 deletions

View File

@@ -144,6 +144,9 @@ func (f StringSliceFlag) Apply(set *flag.FlagSet) {
}
eachName(f.Name, func(name string) {
if f.Value == nil {
f.Value = &StringSlice{}
}
set.Var(f.Value, name, f.Usage)
})
}
@@ -206,6 +209,9 @@ func (f IntSliceFlag) Apply(set *flag.FlagSet) {
}
eachName(f.Name, func(name string) {
if f.Value == nil {
f.Value = &IntSlice{}
}
set.Var(f.Value, name, f.Usage)
})
}