From f20d958c4682a715de86ff0b5d0377d0ee628909 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 7 Sep 2023 14:06:09 +0200 Subject: [PATCH] client: avoid assert() with invalid forceServer op->chan may not be set if Channel::build() throws. eg. if forced server name is invalid for connect(). --- src/clientget.cpp | 4 ++-- src/clientintrospect.cpp | 4 ++-- src/clientmon.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/clientget.cpp b/src/clientget.cpp index e042483..834756d 100644 --- a/src/clientget.cpp +++ b/src/clientget.cpp @@ -582,8 +582,8 @@ std::shared_ptr gpr_setup(const std::shared_ptr& context // on worker // ordering of dispatch()/call() ensures creation before destruction - assert(op->chan); - op->_cancel(true); + if(op->chan) + op->_cancel(true); }, std::move(temp))); }); diff --git a/src/clientintrospect.cpp b/src/clientintrospect.cpp index f6927a7..47caf1c 100644 --- a/src/clientintrospect.cpp +++ b/src/clientintrospect.cpp @@ -208,8 +208,8 @@ std::shared_ptr GetBuilder::_exec_info() // on worker // ordering of dispatch()/call() ensures creation before destruction - assert(op->chan); - op->_cancel(true); + if(op->chan) + op->_cancel(true); }, std::move(temp))); }); diff --git a/src/clientmon.cpp b/src/clientmon.cpp index 8bf249d..86cc39d 100644 --- a/src/clientmon.cpp +++ b/src/clientmon.cpp @@ -848,8 +848,8 @@ std::shared_ptr MonitorBuilder::exec() // on worker // ordering of dispatch()/call() ensures creation before destruction - assert(op->chan); - op->_cancel(true); + if(op->chan) + op->_cancel(true); }, std::move(temp))); });