From 4ba25fbab6d4ee0990d71a0d91c843b04670837d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 11 Feb 2014 10:00:41 +0000 Subject: coverity#705112 Using invalid iterator Change-Id: I6d05e418436b9d0b12be977b7842e1230ba3c7b1 --- reportdesign/source/ui/dlg/GroupsSorting.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index fa705dd0d6d0..60cdac3ed691 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -772,11 +772,14 @@ void OFieldExpressionControl::DeleteRows() m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs); ::std::vector::iterator aFind = ::std::find(m_aGroupPositions.begin(),m_aGroupPositions.end(),nGroupPos); - *aFind = NO_GROUP; - ::std::vector::iterator aEnd = m_aGroupPositions.end(); - for(++aFind;aFind != aEnd;++aFind) - if ( *aFind != NO_GROUP ) - --*aFind; + if (aFind != m_aGroupPositions.end()) + { + *aFind = NO_GROUP; + ::std::vector::iterator aEnd = m_aGroupPositions.end(); + for(++aFind;aFind != aEnd;++aFind) + if ( *aFind != NO_GROUP ) + --*aFind; + } } nIndex = NextSelectedRow(); } -- cgit