From c1a3d80a2bef419133cc1ef607ac4a39b0b8d453 Mon Sep 17 00:00:00 2001 From: TommyLemon Date: Tue, 9 Apr 2024 23:27:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20return=20nil=20=E4=B9=9F?= =?UTF-8?q?=E8=BD=AC=E6=88=90=E4=BA=86=E7=A9=BA=E5=AF=B9=E8=B1=A1=20{}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unitauto/method_util.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unitauto/method_util.go b/unitauto/method_util.go index ef42704..40230c7 100644 --- a/unitauto/method_util.go +++ b/unitauto/method_util.go @@ -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()