sw/source/core/frmedt/tblsel.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5271fc94e706ba64d0c9c40a963d043e0cfa0468
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Feb 3 16:11:40 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sun Feb 4 08:51:44 2024 +0100

    cid#1591481 Dereference after null check
    
    Change-Id: I3c2c94968073e557863f0e1fddf1dea5649a94f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162960
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 98c58068d3ef..095fc767224c 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -1718,7 +1718,7 @@ static void lcl_FindStartEndCol( const SwLayoutFrame 
*&rpStart,
 
     // Beginning and end should not be in protected cells.
     // If necessary we should search backwards again
-    while ( rpStart->GetFormat()->GetProtect().IsContentProtected() )
+    while (rpStart && rpStart->GetFormat()->GetProtect().IsContentProtected())
     {
         const SwLayoutFrame *pTmpLeaf = rpStart->GetNextLayoutLeaf();
         while ( pTmpLeaf && aRectFnSet.GetLeft(pTmpLeaf->getFrameArea()) > nEX 
) // first skip line
@@ -1739,7 +1739,7 @@ static void lcl_FindStartEndCol( const SwLayoutFrame 
*&rpStart,
         else
             rpStart = pTmpLeaf;
     }
-    while ( rpEnd->GetFormat()->GetProtect().IsContentProtected() )
+    while (rpEnd && rpEnd->GetFormat()->GetProtect().IsContentProtected())
     {
         const SwLayoutFrame *pTmpLeaf = rpEnd->GetPrevLayoutLeaf();
         while ( pTmpLeaf && aRectFnSet.GetLeft(pTmpLeaf->getFrameArea()) < nEX 
) // skip the line for now

Reply via email to