Skip to content

Commit

Permalink
解决 return nil 也转成了空对象 {}
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed Apr 9, 2024
1 parent 3217fac commit c1a3d80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion unitauto/method_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,9 @@ func getInvokeResult(typ reflect.Value, returnType reflect.Type, methodName stri
}

var vt = val.Type()
if val.CanInt() {
if val.IsNil() {
vs[i] = nil
} else if val.CanInt() {
vs[i] = val.Int()
} else if val.CanFloat() {
vs[i] = val.Float()
Expand Down

0 comments on commit c1a3d80

Please sign in to comment.