aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-05-25 22:30:56 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-05-25 22:30:56 +0200
commitd457734a191a17ac46ffcf36f85abfd87d0dd943 (patch)
treefd1172cfb35de9d1ebf056ae2ca432d8886a59b5 /Eigen
parent6b800744ce914cf243ac3169e136c5000253f52e (diff)
Avoid calling smart_copy with null pointers.
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/SparseCore/CompressedStorage.h9
1 files changed, 6 insertions, 3 deletions
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;
}