Fix crash on construction of SparseMatrix with zero-length diagonal

libeigen/eigen!2249
This commit is contained in:
Tyler Veness
2026-03-05 17:43:21 -08:00
committed by Charles Schlosser
parent 265496e862
commit d8c8ee6fb2
2 changed files with 5 additions and 1 deletions

View File

@@ -1008,7 +1008,7 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
const bool overwrite = internal::is_same<Func, internal::assign_op<Scalar, Scalar>>::value;
if (overwrite) {
if ((m_outerSize != n) || (m_innerSize != n)) resize(n, n);
if ((m_outerSize != n) || (m_innerSize != n) || (n == 0)) resize(n, n);
}
if (m_data.size() == 0 || overwrite) {