Author: gsim
Date: Mon Feb 11 05:00:45 2008
New Revision: 620479

URL: http://svn.apache.org/viewvc?rev=620479&view=rev
Log:
Check valid listener (or handler) exist and log error if not. See QPID-783.


Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp?rev=620479&r1=620478&r2=620479&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/Dispatcher.cpp Mon Feb 11 
05:00:45 2008
@@ -75,11 +75,18 @@
             if (content->isA<MessageTransferBody>()) {
                 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&) {


Reply via email to