diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-09 15:37:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-09 15:37:31 +0000 |
commit | b8ba31a4028d8af77111b6a078f3ae0390db734b (patch) | |
tree | d62384340a4a1de0f954d00693fd77e5e912afb4 /chart2 | |
parent | 3efa186565eed2f201e604f270134c3a27cfc5b2 (diff) |
coverity#1169832 Using invalid iterator
Change-Id: I40b732f42f48c3d72fed4cee0241a5c6a6cb31a2
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index c514424154a3..8eb97e37f94b 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -948,14 +948,15 @@ void DummyXShapes::remove( const uno::Reference< drawing::XShape>& xShape ) throw(uno::RuntimeException) { std::vector< uno::Reference<drawing::XShape> >::iterator itr = std::find(maUNOShapes.begin(), maUNOShapes.end(), xShape); - - DummyXShape* pChild = dynamic_cast<DummyXShape*>((*itr).get()); - std::vector< DummyXShape* >::iterator itrShape = std::find(maShapes.begin(), maShapes.end(), pChild); - if(itrShape != maShapes.end()) - maShapes.erase(itrShape); - if(itr != maUNOShapes.end()) + { + DummyXShape* pChild = dynamic_cast<DummyXShape*>((*itr).get()); + std::vector< DummyXShape* >::iterator itrShape = std::find(maShapes.begin(), maShapes.end(), pChild); + if(itrShape != maShapes.end()) + maShapes.erase(itrShape); + maUNOShapes.erase(itr); + } } uno::Type DummyXShapes::getElementType() |