summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-12-04 18:30:28 +0100
committerJulien Nabet <serval2412@yahoo.fr>2023-12-04 20:28:26 +0100
commit708e379994591c6e73f07bd2aba136841c9cf036 (patch)
tree2cc44657130445d3853b4604d6d9e2274a6d17a4 /slideshow
parent6bc0020108e8b45954727276ba11b462feb9a4bf (diff)
cid#1545810 Using invalid iterator
and : cid#1545802 Using invalid iterator cid#1545745 Using invalid iterator cid#1545717 Using invalid iterator cid#1545675 Using invalid iterator cid#1545668 Using invalid iterator cid#1545639 Using invalid iterator cid#1545634 Using invalid iterator cid#1545629 Using invalid iterator cid#1545620 Using invalid iterator cid#1545608 Using invalid iterator cid#1545607 Using invalid iterator cid#1545601 Using invalid iterator Change-Id: I403842175f64a570d7e52fba7c3e03bf21b7d05b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160320 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/box2dtools.cxx24
1 files changed, 18 insertions, 6 deletions
diff --git a/slideshow/source/engine/box2dtools.cxx b/slideshow/source/engine/box2dtools.cxx
index 161bbe8c37f4..e831211d7704 100644
--- a/slideshow/source/engine/box2dtools.cxx
+++ b/slideshow/source/engine/box2dtools.cxx
@@ -284,7 +284,9 @@ void box2DWorld::createStaticFrameAroundSlide(const ::basegfx::B2DVector& rSlide
void box2DWorld::setShapePosition(const css::uno::Reference<com::sun::star::drawing::XShape> xShape,
const basegfx::B2DPoint& rOutPos)
{
- Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(xShape)->second;
+ const auto iter = mpXShapeToBodyMap.find(xShape);
+ assert(iter != mpXShapeToBodyMap.end());
+ Box2DBodySharedPtr pBox2DBody = iter->second;
pBox2DBody->setPosition(rOutPos);
}
@@ -295,7 +297,9 @@ void box2DWorld::setShapePositionByLinearVelocity(
assert(mpBox2DWorld);
if (fPassedTime > 0) // this only makes sense if there was an advance in time
{
- Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(xShape)->second;
+ const auto iter = mpXShapeToBodyMap.find(xShape);
+ assert(iter != mpXShapeToBodyMap.end());
+ Box2DBodySharedPtr pBox2DBody = iter->second;
pBox2DBody->setPositionByLinearVelocity(rOutPos, fPassedTime);
}
}
@@ -305,14 +309,18 @@ void box2DWorld::setShapeLinearVelocity(
const basegfx::B2DVector& rVelocity)
{
assert(mpBox2DWorld);
- Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(xShape)->second;
+ const auto iter = mpXShapeToBodyMap.find(xShape);
+ assert(iter != mpXShapeToBodyMap.end());
+ Box2DBodySharedPtr pBox2DBody = iter->second;
pBox2DBody->setLinearVelocity(rVelocity);
}
void box2DWorld::setShapeAngle(const css::uno::Reference<com::sun::star::drawing::XShape> xShape,
const double fAngle)
{
- Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(xShape)->second;
+ const auto iter = mpXShapeToBodyMap.find(xShape);
+ assert(iter != mpXShapeToBodyMap.end());
+ Box2DBodySharedPtr pBox2DBody = iter->second;
pBox2DBody->setAngle(fAngle);
}
@@ -335,7 +343,9 @@ void box2DWorld::setShapeAngularVelocity(
const double fAngularVelocity)
{
assert(mpBox2DWorld);
- Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(xShape)->second;
+ const auto iter = mpXShapeToBodyMap.find(xShape);
+ assert(iter != mpXShapeToBodyMap.end());
+ Box2DBodySharedPtr pBox2DBody = iter->second;
pBox2DBody->setAngularVelocity(fAngularVelocity);
}
@@ -343,7 +353,9 @@ void box2DWorld::setShapeCollision(
const css::uno::Reference<com::sun::star::drawing::XShape> xShape, bool bCanCollide)
{
assert(mpBox2DWorld);
- Box2DBodySharedPtr pBox2DBody = mpXShapeToBodyMap.find(xShape)->second;
+ const auto iter = mpXShapeToBodyMap.find(xShape);
+ assert(iter != mpXShapeToBodyMap.end());
+ Box2DBodySharedPtr pBox2DBody = iter->second;
pBox2DBody->setCollision(bCanCollide);
}