From 50c90fe9836fd4e7b32d7d6665c93659a91f02e3 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 11 Feb 2008 13:00:45 +0000 Subject: Check valid listener (or handler) exist and log error if not. See QPID-783. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@620479 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/Dispatcher.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/client/Dispatcher.cpp b/cpp/src/qpid/client/Dispatcher.cpp index 0783d5bc55..8df4637c88 100644 --- a/cpp/src/qpid/client/Dispatcher.cpp +++ b/cpp/src/qpid/client/Dispatcher.cpp @@ -75,11 +75,18 @@ void Dispatcher::run() if (content->isA()) { Message msg(*content, session); Subscriber::shared_ptr listener = find(msg.getDestination()); - assert(listener); - listener->received(msg); + if (!listener) { + QPID_LOG(error, "No listener found for destination " << msg.getDestination()); + } else { + assert(listener); + listener->received(msg); + } } else { - assert (handler.get()); - handler->handle(*content); + if (handler.get()) { + handler->handle(*content); + } else { + QPID_LOG(error, "No handler found for " << *(content->getMethod())); + } } } } catch (const ClosedException&) { -- cgit v1.2.1