From f03922ab1bcb84b048f53f5b809aa7205c2bb2cf Mon Sep 17 00:00:00 2001 From: linfp <673730411@qq.com> Date: Thu, 26 Sep 2024 11:32:33 +0800 Subject: [PATCH] fix: CallClientStream result has error, result.Result() is nil to *tri.Response will cause a panic (#2732) --- protocol/triple/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protocol/triple/server.go b/protocol/triple/server.go index 40966aebf..0e6dc8279 100644 --- a/protocol/triple/server.go +++ b/protocol/triple/server.go @@ -270,7 +270,12 @@ func (s *Server) handleServiceWithInfo(interfaceName string, invoker protocol.In ctx = context.WithValue(ctx, constant.AttachmentKey, attachments) invo := invocation.NewRPCInvocation(m.Name, args, attachments) res := invoker.Invoke(ctx, invo) - return res.Result().(*tri.Response), res.Error() + if triResp, ok := res.Result().(*tri.Response); ok { + return triResp, res.Error() + } + // please refer to proxy/proxy_factory/ProxyInvoker.Invoke + triResp := tri.NewResponse([]interface{}{res.Result()}) + return triResp, res.Error() }, opts..., )