Avoid calling smart_copy with null pointers.

This commit is contained in:
Gael Guennebaud 2015-05-25 22:30:56 +02:00
parent 6b800744ce
commit d457734a19

View File

@ -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;
}