Unverified Commit 4c227ab8 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #63417 from smarterclayton/map_string

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. FlagMaps may be nil (prior to being initialized) Do not panic if they haven't been set yet. Fixes: #64090
parents ac58ee4c ccec4c50
...@@ -39,6 +39,9 @@ func NewMapStringBool(m *map[string]bool) *MapStringBool { ...@@ -39,6 +39,9 @@ func NewMapStringBool(m *map[string]bool) *MapStringBool {
// String implements github.com/spf13/pflag.Value // String implements github.com/spf13/pflag.Value
func (m *MapStringBool) String() string { func (m *MapStringBool) String() string {
if m == nil || m.Map == nil {
return ""
}
pairs := []string{} pairs := []string{}
for k, v := range *m.Map { for k, v := range *m.Map {
pairs = append(pairs, fmt.Sprintf("%s=%t", k, v)) pairs = append(pairs, fmt.Sprintf("%s=%t", k, v))
......
...@@ -50,6 +50,9 @@ func NewMapStringStringNoSplit(m *map[string]string) *MapStringString { ...@@ -50,6 +50,9 @@ func NewMapStringStringNoSplit(m *map[string]string) *MapStringString {
// String implements github.com/spf13/pflag.Value // String implements github.com/spf13/pflag.Value
func (m *MapStringString) String() string { func (m *MapStringString) String() string {
if m == nil || m.Map == nil {
return ""
}
pairs := []string{} pairs := []string{}
for k, v := range *m.Map { for k, v := range *m.Map {
pairs = append(pairs, fmt.Sprintf("%s=%s", k, v)) pairs = append(pairs, fmt.Sprintf("%s=%s", k, v))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment