You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/03/02 15:17:34 UTC

svn commit: r1076228 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp

Author: tabish
Date: Wed Mar  2 14:17:33 2011
New Revision: 1076228

URL: http://svn.apache.org/viewvc?rev=1076228&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-353

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp?rev=1076228&r1=1076227&r2=1076228&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp Wed Mar  2 14:17:33 2011
@@ -791,13 +791,17 @@ std::string BaseDataStreamMarshaller::re
 
     try{
 
+        std::string text;
         int size = dataIn->readShort();
-        std::vector<char> data( size );
-        dataIn->readFully( (unsigned char*)&data[0], size );
 
-        // Now build a string and copy data into it.
-        std::string text;
-        text.insert( text.begin(), data.begin(), data.end() );
+        if( size > 0 ) {
+
+            std::vector<char> data( size );
+            dataIn->readFully( (unsigned char*)&data[0], size );
+
+            // Now build a string and copy data into it.
+            text.insert( text.begin(), data.begin(), data.end() );
+        }
 
         return text;
     }