activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1076228 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp
Date Wed, 02 Mar 2011 14:17:34 GMT
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;
     }



Mime
View raw message