From e7e5edc02dcbff8ec25fe9bf029a07f02161e604 Mon Sep 17 00:00:00 2001 From: linfp <673730411@qq.com> Date: Wed, 18 Sep 2024 16:58:48 +0800 Subject: [PATCH] fix: CallClientStream result has error, result.Result() is nil to *tri.Response will cause a panic --- 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..., )