3
0

Make sure vars-to-json does not crash if value is nil

This commit is contained in:
Denis Arh
2021-05-04 21:51:36 +02:00
parent 9259dd0cce
commit 9e2d4e9b8b

View File

@@ -284,6 +284,10 @@ func (t *Vars) Set(k string, v interface{}) (err error) {
func (t Vars) MarshalJSON() ([]byte, error) {
aux := make(map[string]*typedValueWrap)
for k, v := range t.value {
if v == nil {
continue
}
aux[k] = &typedValueWrap{Type: v.Type()}
if _, is := v.(json.Marshaler); is {