Skip to content

Commit dc2e2df

Browse files
-- bug fix
1 parent 65a03a3 commit dc2e2df

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

structs.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ func SToMap(s interface{}) map[string]interface{} {
1818
return nil
1919
}
2020

21+
if jsObjectIsNil(s) {
22+
return nil
23+
}
24+
2125
// Check if s is a struct
2226
if isStruct(s) {
2327
return convertStruct(s)
@@ -27,6 +31,10 @@ func SToMap(s interface{}) map[string]interface{} {
2731
case map[string]interface{}:
2832
return x
2933
default:
34+
s := reflect.ValueOf(x)
35+
if s.IsNil() {
36+
return nil
37+
}
3038
panic("unrecognized type")
3139
}
3240
}

0 commit comments

Comments
 (0)