[Liblas-commits] hg-main-tree: fix up stupidity in PointBuffer assignment constru...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Mar 23 11:44:01 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/6c3f542692cd
changeset: 396:6c3f542692cd
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Mar 23 10:43:55 2011 -0500
description:
fix up stupidity in PointBuffer assignment constructor

diffstat:

 src/PointBuffer.cpp |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r eaeee09463b3 -r 6c3f542692cd src/PointBuffer.cpp
--- a/src/PointBuffer.cpp	Wed Mar 23 10:11:26 2011 -0500
+++ b/src/PointBuffer.cpp	Wed Mar 23 10:43:55 2011 -0500
@@ -72,6 +72,7 @@
 }
 
 PointBuffer& PointBuffer::operator=(PointBuffer const& rhs)
+
 {
     if (&rhs != this)
     {
@@ -80,7 +81,10 @@
         m_numPoints = rhs.getNumPoints();
         m_capacity = rhs.getCapacity();
         m_bounds = rhs.getSpatialBounds();
-        memcpy(m_data.get(), rhs.m_data.get(), m_pointSize*m_capacity);
+        boost::scoped_array<boost::uint8_t> m_data( new boost::uint8_t[ m_pointSize*m_capacity ] );
+        
+        if (rhs.m_data.get())
+            memcpy(m_data.get(), rhs.m_data.get(), m_pointSize*m_capacity);
         
         
     }


More information about the Liblas-commits mailing list