diff --git a/Numeric/fullMatrix.h b/Numeric/fullMatrix.h index 41509801b7059c88eae81bea521ac0ee62a7d072..a96d7326b75ee7c9204aa7f0970aea007dc8c62e 100644 --- a/Numeric/fullMatrix.h +++ b/Numeric/fullMatrix.h @@ -97,8 +97,14 @@ class fullMatrix if(this != &other){ _r = other._r; _c = other._c; - _data = new scalar[_r * _c]; - for(int i = 0; i < _r * _c; ++i) _data[i] = other._data[i]; + if (_data) delete[] _data; + if ((_r==0)||(_c==0)) + _data=0; + else + { + _data = new scalar[_r * _c]; + for(int i = 0; i < _r * _c; ++i) _data[i] = other._data[i]; + } } return *this; }