From d457734a191a17ac46ffcf36f85abfd87d0dd943 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 25 May 2015 22:30:56 +0200 Subject: Avoid calling smart_copy with null pointers. --- Eigen/src/SparseCore/CompressedStorage.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Eigen/src/SparseCore') diff --git a/Eigen/src/SparseCore/CompressedStorage.h b/Eigen/src/SparseCore/CompressedStorage.h index 52c7da297..5af270bc5 100644 --- a/Eigen/src/SparseCore/CompressedStorage.h +++ b/Eigen/src/SparseCore/CompressedStorage.h @@ -50,9 +50,12 @@ class CompressedStorage CompressedStorage& operator=(const CompressedStorage& other) { - resize(other.size()); - internal::smart_copy(other.m_values, other.m_values + m_size, m_values); - internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices); + if(other.size()>0) + { + resize(other.size()); + internal::smart_copy(other.m_values, other.m_values + m_size, m_values); + internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices); + } return *this; } -- cgit v1.2.3