[Libreoffice-commits] core.git: sw/source

Julien Nabet serval2412 at yahoo.fr
Sun May 5 13:35:05 PDT 2013


 sw/source/core/layout/trvlfrm.cxx |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 81870e5333722ceb33e9a326af5faa7bc08f89d6
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun May 5 18:26:51 2013 +0200

    coverity#1000604: Dereference after null check
    
    Change-Id: Id9c3b7eb29c58c55c100db6da644b232ada550ee
    Reviewed-on: https://gerrit.libreoffice.org/3791
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index eee460f..0d9fd9c 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -283,6 +283,7 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
             SwCntntNode* pTextNd = aTextPos.nNode.GetNode( ).GetCntntNode( );
             double nTextDistance = 0;
             bool bValidTextDistance = false;
+            bool bConsiderBackground = true;
             if ( pTextNd )
             {
                 SwCntntFrm* pTextFrm = pTextNd->getLayoutFrm( getRootFrm( ) );
@@ -291,19 +292,18 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
 
                 nTextDistance = lcl_getDistance( rTextRect, rPoint );
                 bValidTextDistance = true;
-            }
 
-            bool bConsiderBackground = true;
-            // If the text position is a clickable field, then that should have priority.
-            if (pTextNd->IsTxtNode())
-            {
-                SwTxtNode* pTxtNd = pTextNd->GetTxtNode();
-                SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(aTextPos.nContent.GetIndex(), RES_TXTATR_FIELD);
-                if (pTxtAttr)
+                // If the text position is a clickable field, then that should have priority.
+                if (pTextNd->IsTxtNode())
                 {
-                    const SwField* pField = pTxtAttr->GetFld().GetFld();
-                    if (pField->IsClickable())
-                        bConsiderBackground = false;
+                    SwTxtNode* pTxtNd = pTextNd->GetTxtNode();
+                    SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(aTextPos.nContent.GetIndex(), RES_TXTATR_FIELD);
+                    if (pTxtAttr)
+                    {
+                        const SwField* pField = pTxtAttr->GetFld().GetFld();
+                        if (pField->IsClickable())
+                            bConsiderBackground = false;
+                    }
                 }
             }
 


More information about the Libreoffice-commits mailing list