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 2010/06/08 00:37:12 UTC

svn commit: r952466 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Random.cpp

Author: tabish
Date: Mon Jun  7 22:37:11 2010
New Revision: 952466

URL: http://svn.apache.org/viewvc?rev=952466&view=rev
Log:
Fix the nextBytes method to return early if the vector passed is empty.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Random.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Random.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Random.cpp?rev=952466&r1=952465&r2=952466&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Random.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Random.cpp Mon Jun  7 22:37:11 2010
@@ -48,6 +48,11 @@ bool Random::nextBoolean() {
 void Random::nextBytes( std::vector<unsigned char>& buf ) {
 
     try{
+
+        if( buf.empty() ) {
+            return;
+        }
+
         this->nextBytes( &buf[0], (int)buf.size() );
     }
     DECAF_CATCH_RETHROW( NullPointerException )