From 95fec7d0db7381fa0f06b736f746d5d0e13267f5 Mon Sep 17 00:00:00 2001 From: Nathan Christopher Mittler Date: Wed, 26 Jul 2006 00:44:39 +0000 Subject: [PATCH] Fixing patch for AMQ-824 - adding NULL check for MessageConsumer::autoAcknowledge git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@425574 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/cpp/activemq/MessageConsumer.cpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp b/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp index ddc3c474ac..36d18c6cef 100644 --- a/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp +++ b/openwire-cpp/src/main/cpp/activemq/MessageConsumer.cpp @@ -217,20 +217,26 @@ p MessageConsumer::autoAcknowledge(p message) { try { - // Is the message an ActiveMQMessage? (throws bad_cast otherwise) - p activeMessage = p_dyncast (message) ; + if( message != NULL ) + { + // Is the message an ActiveMQMessage? (throws bad_cast otherwise) + p activeMessage = + p_dyncast (message); + + // Register the handler for client acknowledgment + activeMessage->setAcknowledger( smartify(this) ); - // Register the handler for client acknowledgment - activeMessage->setAcknowledger( smartify(this) ) ; - - if( acknowledgementMode != ClientAckMode ) - doAcknowledge(activeMessage) ; + if( acknowledgementMode != ClientAckMode ) + doAcknowledge(activeMessage); + } } catch( bad_cast& bc ) { // ignore } - return message ; + + // Return the message even if NULL, caller must determine what to do. + return message; } /*