diff --git a/dune/istl/bcrsmatrix.hh b/dune/istl/bcrsmatrix.hh index 0a9fab90d6d4c23d666cd104dafc698e4498217c..e2742f3aeec190264652bd5a6695c756b1fcc06b 100644 --- a/dune/istl/bcrsmatrix.hh +++ b/dune/istl/bcrsmatrix.hh @@ -2149,6 +2149,9 @@ namespace Dune { if (r) DUNE_THROW(InvalidStateException,"Rows have already been allocated, cannot allocate a second time"); r = rowAllocator_.allocate(rows); + // initialize row entries + for(row_type* ri=r; ri!=r+rows; ++ri) + rowAllocator_.construct(ri, row_type()); }else{ r = 0; } @@ -2163,8 +2166,6 @@ namespace Dune { j_.reset(sizeAllocator_.allocate(allocationSize_),Deallocator(sizeAllocator_)); }else{ j_.reset(); - for(row_type* ri=r; ri!=r+rows; ++ri) - rowAllocator_.construct(ri, row_type()); } // Mark the matrix as not built.