[PATCH] coverity#1000604: Dereference after null check

Julien Nabet (via Code Review) gerrit at gerrit.libreoffice.org
Sun May 5 09:27:04 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3791

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/91/3791/1

coverity#1000604: Dereference after null check

Change-Id: Id9c3b7eb29c58c55c100db6da644b232ada550ee
---
M sw/source/core/layout/trvlfrm.cxx
1 file changed, 11 insertions(+), 11 deletions(-)



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 @@
             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 @@
 
                 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;
+                    }
                 }
             }
 

-- 
To view, visit https://gerrit.libreoffice.org/3791
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9c3b7eb29c58c55c100db6da644b232ada550ee
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Julien Nabet <serval2412 at yahoo.fr>



More information about the LibreOffice mailing list