You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/08/30 03:16:53 UTC

[dubbo] 02/02: Fix NPE in RpcInvocation

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

albumenj pushed a commit to branch 3.0-multi-instances
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit f3aff3b2dc298383cb240fda817555c99a95ccae
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Mon Aug 30 11:16:23 2021 +0800

    Fix NPE in RpcInvocation
---
 .../src/main/java/org/apache/dubbo/rpc/RpcInvocation.java             | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
index c7e7187..a828ca0 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
@@ -179,10 +179,10 @@ public class RpcInvocation implements Invocation, Serializable {
     }
 
     private void initParameterDesc() {
-        ServiceDescriptor serviceDescriptor;
+        ServiceDescriptor serviceDescriptor = null;
         if (serviceModel != null) {
             serviceDescriptor = serviceModel.getServiceModel();
-        } else {
+        } else if (StringUtils.isNotEmpty(serviceName)){
             ServiceRepository repository = ApplicationModel.defaultModel().getApplicationServiceRepository();
             serviceDescriptor = repository.lookupService(serviceName);
         }