@@ -16,8 +16,10 @@ func getBoolFromKVOrDefault(properties map[string]string, key string, def bool)
1616 if len (val ) == 0 {
1717 return def
1818 }
19- str := util .Unquote (val [0 ])
20- if len (str ) == 0 {
19+ //I think this function and those below should handle error, but they didn't.
20+ //Since a default value (def) is provided, any parsing errors will result in the default being returned.
21+ str , err := strconv .Unquote (val [0 ])
22+ if err != nil || len (str ) == 0 {
2123 return def
2224 }
2325 res , _ := strconv .ParseBool (str )
@@ -33,8 +35,8 @@ func getStringFromKVOrDefault(properties map[string]string, key string, def stri
3335 if len (val ) == 0 {
3436 return def
3537 }
36- str := util .Unquote (val [0 ])
37- if len (str ) == 0 {
38+ str , err := strconv .Unquote (val [0 ])
39+ if err != nil || len (str ) == 0 {
3840 return def
3941 }
4042 return str
@@ -50,8 +52,8 @@ func getListFromInfoOrDefault(properties map[string]string, key string, def []st
5052 return def
5153 }
5254
53- str := util .Unquote (val [0 ])
54- if len (str ) == 0 {
55+ str , err := strconv .Unquote (val [0 ])
56+ if err != nil || len (str ) == 0 {
5557 return def
5658 }
5759 resp := util .FieldsAndTrimSpace (str , commaRune )
@@ -66,8 +68,8 @@ func getFirstUsableString(def ...string) string {
6668 return ""
6769 }
6870 for _ , val := range def {
69- str := util .Unquote (val )
70- if len (str ) != 0 {
71+ str , err := strconv .Unquote (val )
72+ if err == nil && len (str ) != 0 {
7173 return str
7274 }
7375 }
0 commit comments