Add an internal assertion in makeCompressed to catch a possible risk of null-pointer access.

This commit is contained in:
Gael Guennebaud 2015-02-18 11:29:54 +01:00
parent eb563049f7
commit 63464754ef

View File

@ -467,6 +467,8 @@ class SparseMatrix
if(isCompressed()) if(isCompressed())
return; return;
eigen_internal_assert(m_outerIndex!=0 && m_outerSize>0);
Index oldStart = m_outerIndex[1]; Index oldStart = m_outerIndex[1];
m_outerIndex[1] = m_innerNonZeros[0]; m_outerIndex[1] = m_innerNonZeros[0];
for(Index j=1; j<m_outerSize; ++j) for(Index j=1; j<m_outerSize; ++j)