sw/source/core/layout/colfrm.cxx |   14 +++++++++-----
 sw/source/core/layout/tabfrm.cxx |    2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 9d2903e613b2aa14c83ed6b361889aac5f7254f0
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Dec 23 11:31:23 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 8 11:53:56 2025 +0100

    crashreporting: check Lower()
    
    See 
https://crashreport.libreoffice.org/stats/signature/SwRowFrame::ShouldRowKeepWithNext(bool)
    
    Change-Id: I49ac8312e0288471780c405bb2cd7eb66163ab43
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179233
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit ce913724f648061b534098f2deda362791e15386)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179879
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 83a9414af546..59eb4bc3dd82 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5623,7 +5623,7 @@ bool SwRowFrame::ShouldRowKeepWithNext( const bool 
bCheckParents ) const
         return false;
 
     const SwCellFrame* pCell = static_cast<const SwCellFrame*>(Lower());
-    const SwFrame* pText = pCell->Lower();
+    const SwFrame* pText = pCell ? pCell->Lower() : nullptr;
 
     return pText && pText->IsTextFrame() && !pText->IsHiddenNow() &&
            static_cast<const 
SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue();
commit 0a9acaa251285b4066fe4cd712fe0fdebe919e2d
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Dec 23 11:44:19 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 8 11:53:46 2025 +0100

    crashreporting: check Lower()
    
    See 
https://crashreport.libreoffice.org/stats/signature/SwLayoutFrame::AdjustColumns(SwFormatCol%20const%20*,bool)
    
    Change-Id: I690a6358c8964f5511aedf3246384649cf004d9f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179234
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit e080eebd4ebb20ddb0aff1f168096ec22b326546)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179248
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 32e792800a6635da9cdf88a2348e72c35286a2a2)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179878

diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index e29b295c46da..0e333c6d0892 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -312,9 +312,13 @@ void SwLayoutFrame::ChgColumns( const SwFormatCol &rOld, 
const SwFormatCol &rNew
 
 void SwLayoutFrame::AdjustColumns( const SwFormatCol *pAttr, bool 
bAdjustAttributes )
 {
-    if( !Lower()->GetNext() )
+    SwFrame* pLower = Lower();
+    if (!pLower)
+        return;
+
+    if( !pLower->GetNext() )
     {
-        Lower()->ChgSize( getFramePrintArea().SSize() );
+        pLower->ChgSize( getFramePrintArea().SSize() );
         return;
     }
 
@@ -328,7 +332,7 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol 
*pAttr, bool bAdjustAttribu
         if ( !bAdjustAttributes )
         {
             tools::Long nAvail = fnRect.GetWidth(getFramePrintArea());
-            for ( SwLayoutFrame *pCol = static_cast<SwLayoutFrame*>(Lower());
+            for ( SwLayoutFrame *pCol = static_cast<SwLayoutFrame*>(pLower);
                   pCol;
                   pCol = static_cast<SwLayoutFrame*>(pCol->GetNext()) )
                 nAvail -= fnRect.GetWidth(pCol->getFrameArea());
@@ -344,7 +348,7 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol 
*pAttr, bool bAdjustAttribu
     const sal_uInt16 nMin = bLine ? sal_uInt16( 20 + ( pAttr->GetLineWidth() / 
2) ) : 0;
 
     const bool bR2L = IsRightToLeft();
-    SwFrame *pCol = bR2L ? GetLastLower() : Lower();
+    SwFrame *pCol = bR2L ? GetLastLower() : pLower;
 
     // #i27399#
     // bOrtho means we have to adjust the column frames manually. Otherwise
@@ -429,7 +433,7 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol 
*pAttr, bool bAdjustAttribu
         return;
 
     tools::Long nInnerWidth = ( nAvail - nGutter ) / pAttr->GetNumCols();
-    pCol = Lower();
+    pCol = pLower;
     for( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; pCol = 
pCol->GetNext(), ++i ) //i118878, value returned by GetNumCols() can't be 
trusted
     {
         SwTwips nWidth;

Reply via email to