diff --git a/include/armadillo_bits/Mat_meat.hpp b/include/armadillo_bits/Mat_meat.hpp index a96fbd9b..4cb8d765 100644 --- a/include/armadillo_bits/Mat_meat.hpp +++ b/include/armadillo_bits/Mat_meat.hpp @@ -2657,6 +2657,8 @@ Mat::operator=(const SpBase& m) (*this).zeros(x.n_rows, x_n_cols); + if(x.n_nonzero == 0) { return *this; } + const eT* x_values = x.values; const uword* x_row_indices = x.row_indices; const uword* x_col_ptrs = x.col_ptrs;