You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2024/09/26 03:32:39 UTC

(dubbo-go) branch main updated: fix: CallClientStream result has error, result.Result() is nil to *tri.Response will cause a panic (#2732)

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/main by this push:
     new f03922ab1 fix: CallClientStream result has error, result.Result() is nil to *tri.Response will cause a panic (#2732)
f03922ab1 is described below

commit f03922ab1bcb84b048f53f5b809aa7205c2bb2cf
Author: linfp <67...@qq.com>
AuthorDate: Thu Sep 26 11:32:33 2024 +0800

    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...,
 			)