sw/source/core/text/widorp.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit fff6e491f830daf18088f025fad6ce8118ec6108
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Apr 15 10:05:55 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Apr 15 14:10:40 2024 +0200

    cid#1596323 Dereference null return value
    
    Change-Id: I63eeb8662ee28f1a0e990160b1ff9992d9d9337f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166111
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index acb3fe32cd31..5446ac8cec15 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -479,11 +479,14 @@ bool WidowsAndOrphans::FindWidows( SwTextFrame *pFrame, 
SwTextMargin &rLine )
         {
             const SwSectionFrame* const pSct = pFrame->FindSctFrame();
             // multi-column section
-            if ( pSct->Lower()->IsColumnFrame() && pSct->Lower()->GetNext()
-                 // and not in the last column
-                 && !pFrame->FindColFrame()->GetNext() )
+            if ( pSct->Lower()->IsColumnFrame() && pSct->Lower()->GetNext() )
             {
-                bKeep = false;
+                const SwFrame *pCol = pFrame->FindColFrame();
+                // and not in the last column
+                if (pCol && !pCol->GetNext())
+                {
+                    bKeep = false;
+                }
             }
         }
 

Reply via email to