sw/source/core/table/swtable.cxx |   49 ++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

New commits:
commit b0090023b09cdbbfff5cc5a6acf1cc976eb33175
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Aug 16 09:27:04 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Aug 17 09:49:33 2022 +0200

    cid#1509187 Dereference after null check
    
    Change-Id: I5e50670dd28f90621e155a2d851ad5b732f588c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138362
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 1863316d1531..554617e81ec0 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1533,30 +1533,33 @@ SwTwips SwTableLine::GetTableLineHeight( bool& 
bLayoutAvailable ) const
     const SwTabFrame* pChain = nullptr; // My chain
     for( SwRowFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
     {
-        if( pLast->GetTabLine() == this )
-        {
-            const SwTabFrame* pTab = pLast->FindTabFrame();
-            bLayoutAvailable = ( pTab && pTab->IsVertical() ) ?
-                               ( 0 < pTab->getFrameArea().Height() ) :
-                               ( 0 < pTab->getFrameArea().Width() );
+        if (pLast->GetTabLine() != this)
+            continue;
 
-            // The first one defines the chain, if a chain is defined, only 
members of the chain
-            // will be added.
-            if (pTab && (!pChain || pChain->IsAnFollow( pTab ) || 
pTab->IsAnFollow(pChain)))
-            {
-                pChain = pTab; // defines my chain (even it is already)
-                if( pTab->IsVertical() )
-                    nRet += pLast->getFrameArea().Width();
-                else
-                    nRet += pLast->getFrameArea().Height();
-                // Optimization, if there are no master/follows in my chain, 
nothing more to add
-                if( !pTab->HasFollow() && !pTab->IsFollow() )
-                    break;
-                // This is not an optimization, this is necessary to avoid 
double additions of
-                // repeating rows
-                if( pTab->IsInHeadline(*pLast) )
-                    break;
-            }
+        const SwTabFrame* pTab = pLast->FindTabFrame();
+        if (!pTab)
+            continue;
+
+        bLayoutAvailable = ( pTab->IsVertical() ) ?
+                           ( 0 < pTab->getFrameArea().Height() ) :
+                           ( 0 < pTab->getFrameArea().Width() );
+
+        // The first one defines the chain, if a chain is defined, only 
members of the chain
+        // will be added.
+        if (!pChain || pChain->IsAnFollow( pTab ) || pTab->IsAnFollow(pChain))
+        {
+            pChain = pTab; // defines my chain (even it is already)
+            if( pTab->IsVertical() )
+                nRet += pLast->getFrameArea().Width();
+            else
+                nRet += pLast->getFrameArea().Height();
+            // Optimization, if there are no master/follows in my chain, 
nothing more to add
+            if( !pTab->HasFollow() && !pTab->IsFollow() )
+                break;
+            // This is not an optimization, this is necessary to avoid double 
additions of
+            // repeating rows
+            if( pTab->IsInHeadline(*pLast) )
+                break;
         }
     }
     return nRet;

Reply via email to