Skip to content

Commit

Permalink
fixToMapError
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzuochao authored and JacksonTian committed Apr 13, 2020
1 parent 4d8a898 commit 28a4a7b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tea/tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,25 @@ func Merge(args ...interface{}) map[string]string {
return finalArg
}

func isNil(a interface{}) bool {
defer func() {
recover()
}()
vi := reflect.ValueOf(a)
return vi.IsNil()
}

func ToMap(args ...interface{}) map[string]interface{} {
isNotNil := false
finalArg := make(map[string]interface{})
for _, obj := range args {
if obj == nil {
continue
}

if isNil(obj) {
continue
}
isNotNil = true

switch obj.(type) {
Expand Down

0 comments on commit 28a4a7b

Please sign in to comment.