sd/source/ui/view/drtxtob1.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 4354919a9e5bea6182b23c7fbc93ce082111a44c
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Tue Jan 28 01:37:07 2025 +0100
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Tue Jan 28 09:33:26 2025 +0100

    tdf#164855 sd - fix crash while centering table contents
    
    regression from: 1d9ce0a67a71e51569cd33c26270eeece587a354
    (tdf#162571 - sd: Text box expands or shrinks on left or right...)
    
    Change-Id: I75425dc15f40a32c353284f0a1338e117b8db018
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180809
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index b0fbe31bc984..370fa9dffb06 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -616,14 +616,17 @@ SET_ADJUST:
                     {
                         aNewAttr.Put(SvxAdjustItem(eAdjst, EE_PARA_JUST));
                         // set anchor
-                        ESelection aSel = pOLV->GetSelection();
-                        aSel.Adjust();
-                        sal_Int32 nStartPara = aSel.start.nPara;
-                        if (!aSel.HasRange())
-                            nStartPara = 0;
-
-                        if (nStartPara == 0)
-                            aNewAttr.Put(SdrTextHorzAdjustItem(eAnchor));
+                        if (pOLV)
+                        {
+                            ESelection aSel = pOLV->GetSelection();
+                            aSel.Adjust();
+                            sal_Int32 nStartPara = aSel.start.nPara;
+                            if (!aSel.HasRange())
+                                nStartPara = 0;
+
+                            if (nStartPara == 0)
+                                aNewAttr.Put(SdrTextHorzAdjustItem(eAnchor));
+                        }
                     }
                     break;
 

Reply via email to