From d505581af95a1180d0b01bcfc8f9f0483354f7d0 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Thu, 11 Nov 2010 09:33:35 +0000 Subject: [PATCH] bug fixing in vector_ocf::reserve for the case of empty vector --- vcg/simplex/face/component_ocf.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vcg/simplex/face/component_ocf.h b/vcg/simplex/face/component_ocf.h index ff728a9e..ebd1cae4 100644 --- a/vcg/simplex/face/component_ocf.h +++ b/vcg/simplex/face/component_ocf.h @@ -162,7 +162,6 @@ public: } void reserve(const unsigned int & _size) { - ThisTypeIterator oldbegin=(*this).begin(); BaseType::reserve(_size); if (QualityEnabled) QV.reserve(_size); @@ -175,6 +174,9 @@ public: if (WedgeColorEnabled) WCV.reserve(_size); if (WedgeNormalEnabled) WNV.reserve(_size); + if( BaseType::empty()) return ; + + ThisTypeIterator oldbegin=(*this).begin(); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end()); } @@ -592,7 +594,7 @@ public: WedgeColorOcf(){ } typedef A ColorType; ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } - const ColorType & cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } + const ColorType cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } template void ImportData(const LeftF & leftF){ //if(this->Base().WedgeColorEnabled && leftF.Base().WedgeColorEnabled) // WRONG I do not know anything about leftV!