diff --git a/istl/basearray.hh b/istl/basearray.hh
index 13efc2f1ffa65159104bb4ec5c194909a147f085..c0fccd6c0661cbe65bd200aec189647f0e89fb0a 100644
--- a/istl/basearray.hh
+++ b/istl/basearray.hh
@@ -691,7 +691,7 @@ namespace Dune {
         else l = q+1;
       }
 
-      if (i==j[l])
+      if (n && i==j[l])
         return iterator(p,j,l);
       else
         return iterator(p,j,n);
@@ -735,7 +735,7 @@ namespace Dune {
         else l = q+1;
       }
 
-      if (i==j[l])
+      if (n && i==j[l])
         return const_iterator(p,j,l);
       else
         return const_iterator(p,j,n);