diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-01-24 14:20:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-24 14:20:03 +0000 |
commit | 3768b305c062086aed1719d8ce1022f8af63f6d5 (patch) | |
tree | ad3084bec65c7f9f57df58ae8705d4f3b3f4af60 /sd/source | |
parent | 65ff0a58630c33680f4375636e6af1870def2e9c (diff) |
coverity#704751 Explicit null dereferenced
Change-Id: If95204a7e8e47ef62599da3374b6a2908e495493
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/func/fuoaprms.cxx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx index 8ceff8b190be..195991509de7 100644 --- a/sd/source/ui/func/fuoaprms.cxx +++ b/sd/source/ui/func/fuoaprms.cxx @@ -654,21 +654,24 @@ void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq ) pRunningObj = pObject1; } - DBG_ASSERT(pPath, "no curve found"); + assert(pRunningObj && pPath && "no curve found"); // push the running object to the end of the curve - Rectangle aCurRect(pRunningObj->GetLogicRect()); - Point aCurCenter(aCurRect.Center()); - const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly(); - sal_uInt32 nNoOfPolygons(rPolyPolygon.count()); - const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1L)); - sal_uInt32 nPoints(aPolygon.count()); - const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1L)); - const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY())); - Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y()); - pRunningObj->Move(aDistance); - - pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance)); + if (pRunningObj) + { + Rectangle aCurRect(pRunningObj->GetLogicRect()); + Point aCurCenter(aCurRect.Center()); + const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly(); + sal_uInt32 nNoOfPolygons(rPolyPolygon.count()); + const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1L)); + sal_uInt32 nPoints(aPolygon.count()); + const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1L)); + const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY())); + Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y()); + pRunningObj->Move(aDistance); + + pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance)); + } } for (size_t nObject = 0; nObject < nCount; ++nObject) |