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

gabriellee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7988fed0f70 [minor](rpc) Check client before RPC (#43626)
7988fed0f70 is described below

commit 7988fed0f70163d7e63ad5e14c21ce0c29407264
Author: Gabriel <[email protected]>
AuthorDate: Wed Nov 13 10:10:49 2024 +0800

    [minor](rpc) Check client before RPC (#43626)
    
    Check client before RPC
---
 be/src/runtime/client_cache.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/client_cache.h b/be/src/runtime/client_cache.h
index d29db827862..c5f44f55e09 100644
--- a/be/src/runtime/client_cache.h
+++ b/be/src/runtime/client_cache.h
@@ -35,6 +35,7 @@
 #include <unordered_map>
 
 #include "common/config.h"
+#include "common/exception.h"
 #include "common/status.h"
 #include "util/hash_util.hpp"
 #include "util/metrics.h"
@@ -189,7 +190,12 @@ public:
 
     inline bool is_alive() { return _client != nullptr; }
 
-    T* operator->() const { return _client; }
+    T* operator->() const {
+        if (_client == nullptr) {
+            throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Invalid RPC 
client!");
+        }
+        return _client;
+    }
 
 private:
     ClientCache<T>* _client_cache = nullptr;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to