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

yiguolei pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new ca6b3e7d15c branch-3.0: [minor](rpc) Check client before RPC (#43816)
ca6b3e7d15c is described below

commit ca6b3e7d15c301e245831fd8c22b9efd342a3048
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 13 19:37:57 2024 +0800

    branch-3.0: [minor](rpc) Check client before RPC (#43816)
    
    Cherry-picked from #43626
    
    Co-authored-by: Gabriel <liwenqi...@selectdb.com>
---
 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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to