From 64121a303b5ceb3dd149215529ef8346b6d00dcd Mon Sep 17 00:00:00 2001 From: Regina Henschel Date: Tue, 15 Aug 2023 01:09:25 +0200 Subject: [PATCH] CID 1539919: Null pointer dereferences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem was introduced in 631964a2ce1da3fbbeb53a5550c0e6728ba644aa tfd#112687 Combine adjacent lines into one shape Change-Id: I4c064a22e5fcc0040e249dbde09ee591ac2693c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155686 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- slideshow/source/engine/slideshowimpl.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 33a9825e544a..81661fab215a 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1445,14 +1445,16 @@ void lcl_setPropertiesToShape(const drawing::PointSequenceSequence& rPoints, aXPropSet->setPropertyValue("LineCap", uno::Any(eLC)); //LineColor - sal_uInt32 nLineColor; - nLineColor = pCanvasPolyPoly->getRGBALineColor(); + sal_uInt32 nLineColor = 0; + if (pCanvasPolyPoly) + nLineColor = pCanvasPolyPoly->getRGBALineColor(); //Transform polygon color from RRGGBBAA to AARRGGBB aXPropSet->setPropertyValue("LineColor", uno::Any(RGBAColor2UnoColor(nLineColor))); //LineWidth - double fLineWidth; - fLineWidth = pCanvasPolyPoly->getStrokeWidth(); + double fLineWidth = 0; + if (pCanvasPolyPoly) + fLineWidth = pCanvasPolyPoly->getStrokeWidth(); aXPropSet->setPropertyValue("LineWidth", uno::Any(static_cast(fLineWidth))); } @@ -1509,7 +1511,7 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult // We collect these points into one B2DPolygon and use that to generate the shape on the // slide. ::basegfx::B2DPolygon aDrawingPoints; - cppcanvas::PolyPolygonSharedPtr pFirstPolyPoly; // for style properties + cppcanvas::PolyPolygonSharedPtr pFirstPolyPoly = aPolygons.front(); // for style properties for( const auto& pPolyPoly : aPolygons ) { // Actually, each item in aPolygons has two points, but wrapped in a cppcanvas::PopyPolygon.