From dd4a046cd2ac3780b956fabe0748a2d5caf8c211 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Wed, 20 Aug 2025 13:47:21 +0800 Subject: [PATCH] fix empty callback --- include/rest_rpc/rpc_client.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/rest_rpc/rpc_client.hpp b/include/rest_rpc/rpc_client.hpp index d1b8eb4..61a040d 100644 --- a/include/rest_rpc/rpc_client.hpp +++ b/include/rest_rpc/rpc_client.hpp @@ -608,6 +608,9 @@ private: std::shared_ptr cl = nullptr; { std::unique_lock lock(cb_mtx_); + if (callback_map_.empty()) { + return; + } cl = std::move(callback_map_[req_id]); } @@ -624,6 +627,9 @@ private: callback_map_.erase(req_id); } else { std::unique_lock lock(cb_mtx_); + if (future_map_.empty()) { + return; + } auto &f = future_map_[req_id]; if (ec) { // LOG<