diff --git a/include/armadillo_bits/subview_cube_meat.hpp b/include/armadillo_bits/subview_cube_meat.hpp index 8382fbce..8b0e9c3a 100644 --- a/include/armadillo_bits/subview_cube_meat.hpp +++ b/include/armadillo_bits/subview_cube_meat.hpp @@ -1125,6 +1125,8 @@ subview_cube::each_slice(const std::function< void(Mat&) >& F) { arma_debug_sigprint(); + if( (n_rows == 0) || (n_cols == 0) ) { return; } + Mat tmp1(n_rows, n_cols, arma_nozeros_indicator()); Mat tmp2('j', tmp1.memptr(), n_rows, n_cols); @@ -1153,6 +1155,8 @@ subview_cube::each_slice(const std::function< void(const Mat&) >& F) con { arma_debug_sigprint(); + if( (n_rows == 0) || (n_cols == 0) ) { return; } + Mat tmp1(n_rows, n_cols, arma_nozeros_indicator()); const Mat tmp2('j', tmp1.memptr(), n_rows, n_cols);