svx/source/sdr/primitive2d/sdrattributecreator.cxx |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit f9d2326fe5264a079dde623d99c20195a029fbbe
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Aug 30 08:34:18 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Aug 30 11:23:35 2024 +0200

    cid#1618704 Dereference after null check
    
    and
    
    cid#1618705 Dereference after null check
    cid#1618707 Dereference after null check
    
    Change-Id: I942a9d67d127fa965730a5c38ea8e71397397e0b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172631
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 06dabd314649..f1628354283d 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -207,7 +207,7 @@ namespace drawinglayer
             return glowAttr;
         }
 
-        attribute::SdrGlowTextAttribute createNewSdrGlowTextAttribute(const 
SfxItemSet& rSet, const SdrTextObj& rTextObj)
+        attribute::SdrGlowTextAttribute createNewSdrGlowTextAttribute(const 
SfxItemSet& rSet, const OutlinerParaObject* pOutliner)
         {
             sal_Int32 nTextRadius = 
rSet.Get(SDRATTR_GLOW_TEXT_RADIUS).GetValue();
 
@@ -226,9 +226,9 @@ namespace drawinglayer
             if (const SvxFontHeightItem* pItem = 
rSet.GetItemIfSet(EE_CHAR_FONTHEIGHT))
                 nFontSize = pItem->GetHeight();
 
-            if (rTextObj.GetOutlinerParaObject())
+            if (pOutliner)
             {
-                const EditTextObject& aEdit = 
rTextObj.GetOutlinerParaObject()->GetTextObject();
+                const EditTextObject& aEdit = pOutliner->GetTextObject();
                 for (sal_Int32 i = 0; i < aEdit.GetParagraphCount(); i++)
                 {
                     std::vector<EECharAttrib> aAttribs;
@@ -808,7 +808,8 @@ namespace drawinglayer::primitive2d
             // try shadow
             const attribute::SdrShadowAttribute 
aShadow(createNewSdrShadowAttribute(rSet));
             const attribute::SdrGlowAttribute 
aGlow(createNewSdrGlowAttribute(rSet));
-            const attribute::SdrGlowTextAttribute 
aGlowText(createNewSdrGlowTextAttribute(rSet, pText->GetObject()));
+            const OutlinerParaObject* pOutliner = pText ? 
pText->GetObject().GetOutlinerParaObject() : nullptr;
+            const attribute::SdrGlowTextAttribute 
aGlowText(createNewSdrGlowTextAttribute(rSet, pOutliner));
             const sal_Int32 nSoftEdgeRadius(getSoftEdgeRadius(rSet));
 
             return attribute::SdrEffectsTextAttribute(aShadow, 
std::move(aText),
@@ -856,7 +857,8 @@ namespace drawinglayer::primitive2d
                 // try shadow
                 attribute::SdrShadowAttribute 
aShadow(createNewSdrShadowAttribute(rSet));
                 attribute::SdrGlowAttribute aGlow = 
createNewSdrGlowAttribute(rSet);
-                attribute::SdrGlowTextAttribute aGlowText = 
createNewSdrGlowTextAttribute(rSet, pText->GetObject());
+                const OutlinerParaObject* pOutliner = pText ? 
pText->GetObject().GetOutlinerParaObject() : nullptr;
+                attribute::SdrGlowTextAttribute aGlowText = 
createNewSdrGlowTextAttribute(rSet, pOutliner);
                 const sal_Int32 nSoftEdgeRadius(getSoftEdgeRadius(rSet));
 
                 return attribute::SdrLineEffectsTextAttribute(std::move(aLine),
@@ -931,7 +933,8 @@ namespace drawinglayer::primitive2d
                 const attribute::SdrGlowAttribute aGlow = 
createNewSdrGlowAttribute(rSet);
 
                 // text glow
-                const attribute::SdrGlowTextAttribute aGlowText = 
createNewSdrGlowTextAttribute(rSet, pText->GetObject());
+                const OutlinerParaObject* pOutliner = pText ? 
pText->GetObject().GetOutlinerParaObject() : nullptr;
+                const attribute::SdrGlowTextAttribute aGlowText = 
createNewSdrGlowTextAttribute(rSet, pOutliner);
 
                 const sal_Int32 nSoftEdgeRadius(getSoftEdgeRadius(rSet));
 
commit bf878dd7c8aabd975f7ba99daba3fa9e959d1d2c
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Aug 30 08:28:59 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Aug 30 11:23:27 2024 +0200

    cid#1618703 Dereference null return value
    
    Change-Id: I9c0dc25565e8c11d3c0b4328a493d5fc746184e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172630
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 192e6b080acf..06dabd314649 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -222,8 +222,9 @@ namespace drawinglayer
 
             // calculate rendering text glow radius from biggest Char size for 
the full text in shape
             double nRadius = 0.0;
-            const SvxFontHeightItem& rItem = 
*rSet.GetItemIfSet(EE_CHAR_FONTHEIGHT);
-            sal_uInt32 nFontSize = rItem.GetHeight();
+            sal_uInt32 nFontSize = 0;
+            if (const SvxFontHeightItem* pItem = 
rSet.GetItemIfSet(EE_CHAR_FONTHEIGHT))
+                nFontSize = pItem->GetHeight();
 
             if (rTextObj.GetOutlinerParaObject())
             {

Reply via email to