From 15800bb19856405d43ec05f6dca049b6866f2be6 Mon Sep 17 00:00:00 2001
From: Markus Blatt <mblatt@dune-project.org>
Date: Tue, 18 Dec 2012 15:40:38 +0000
Subject: [PATCH] Bugfix: Removed Segfault.

[[Imported from SVN: r1748]]
---
 dune/istl/solvers.hh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dune/istl/solvers.hh b/dune/istl/solvers.hh
index a2c88c3b..55614e97 100644
--- a/dune/istl/solvers.hh
+++ b/dune/istl/solvers.hh
@@ -1601,7 +1601,7 @@ namespace Dune {
 
       while(i<_maxit) {
         // the loop
-        int end=std::min(_restart, _maxit-i);
+        int end=std::min(_restart, _maxit-i+1);
         for (ii=1; ii<end; ++ii )
         {
           //std::cout<<" ii="<<ii<<" i="<<i<<std::endl;
@@ -1640,8 +1640,10 @@ namespace Dune {
         }
         if(res.converged)
           break;
-        *(p[0])=*(p[_restart-1]);
-        pp[0]=pp[_restart-1];
+        if(end==_restart) {
+          *(p[0])=*(p[_restart-1]);
+          pp[0]=pp[_restart-1];
+        }
       }
 
       // postprocess preconditioner
-- 
GitLab