From: Wolfgang Bangerth Date: Tue, 18 May 2004 21:47:40 +0000 (+0000) Subject: Fix a problem where we were running past the end of an array and still X-Git-Tag: v8.0.0~15169 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=051e6b3de2f863835404d8fb81ba91de23d497de;p=dealii.git Fix a problem where we were running past the end of an array and still dereferenced the iterator. git-svn-id: https://svn.dealii.org/trunk@9260 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/dofs/dof_constraints.cc b/deal.II/deal.II/source/dofs/dof_constraints.cc index 26370850e9..ec70e24e9e 100644 --- a/deal.II/deal.II/source/dofs/dof_constraints.cc +++ b/deal.II/deal.II/source/dofs/dof_constraints.cc @@ -1176,7 +1176,17 @@ bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const p = std::lower_bound (lines.begin (), lines.end (), index_comparison); - return ((p->line == index) && + // return if an entry for this + // line was found and if it has + // only one entry equal to 1.0 + // + // note that lower_bound only + // returns a valid iterator if + // 'index' is less than the + // largest line index in out + // constraints list + return ((p != lines.end()) && + (p->line == index) && (p->entries.size() == 1) && (p->entries[0].second == 1.0)); } @@ -1189,7 +1199,7 @@ bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const (i->entries[0].second == 1.0)); return false; - }; + } }