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

Luboš Luňák l.lunak at collabora.com
Sun Sep 14 11:19:29 PDT 2014


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

New commits:
commit 99cd15fa238886d23bdc429dc1133157d799487a
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Sun Sep 14 20:16:51 2014 +0200

    avoid possible NULL dereference (fdo#82777)
    
    Change-Id: Ifec915d5b2c9e5f7558e7850eb44e44300c9b374

diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index f533365..ce15334 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2573,11 +2573,11 @@ void SwRootFrm::CalcFrmRects(SwShellCrsr &rCrsr)
                 const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
                 const SwVirtFlyDrawObj* pObj = pFly->GetVirtDrawObj();
                 const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
-                SwPosition anchoredAt = *pAnchoredObj->GetFrmFmt().GetAnchor().GetCntntAnchor();
-                bool inSelection = ( *pStartPos <= anchoredAt && anchoredAt < *pEndPos );
-                if( anchoredAt == *pEndPos )
+                const SwPosition* anchoredAt = pAnchoredObj->GetFrmFmt().GetAnchor().GetCntntAnchor();
+                bool inSelection = ( anchoredAt != NULL && *pStartPos <= *anchoredAt && *anchoredAt < *pEndPos );
+                if( anchoredAt != NULL && *anchoredAt == *pEndPos )
                 {
-                    const SwNodes& nodes = anchoredAt.GetDoc()->GetNodes();
+                    const SwNodes& nodes = anchoredAt->GetDoc()->GetNodes();
                     if( *pEndPos == SwPosition( nodes.GetEndOfContent()))
                         inSelection = true;
                     else


More information about the Libreoffice-commits mailing list