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

Caolán McNamara caolanm at redhat.com
Wed Feb 15 09:07:42 UTC 2017


 sw/source/core/layout/fly.cxx |   21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 4e0ac535a96dc461a795d399677123eebf0cf787
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 15 09:02:23 2017 +0000

    coverity#1400531 Dereference before null check
    
    Change-Id: Iff64a2dd599c6881e92e0cf49a0f535104a49ac1

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 383ef52..02b32b0 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -437,12 +437,7 @@ void SwFlyFrame::FinitDrawObj()
             }
         }
     }
-    if(!pFormat)
-    {
-        GetVirtDrawObj()->SetUserCall(nullptr);
-        delete GetVirtDrawObj();
-        return;
-    }
+
     bool bOtherFramesAround(false);
     SwFlyDrawContact* pContact(nullptr);
     pFormat->CallSwClientNotify(sw::KillDrawHint(this, bOtherFramesAround, pContact));
commit 82f65d5753eca4549a4e37285e75315a94e1a863
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 15 08:58:10 2017 +0000

    coverity#1400529 Unchecked dynamic_cast
    
    Change-Id: I8879fbca5c9a77ec1e21c096ab3323c7a341e709

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 55f1ac2..383ef52 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -667,19 +667,19 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize &rFrameSize )
 void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
     SwFrame::SwClientNotify(rMod, rHint);
-    if(auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
+    if (auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
     {
-        auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
-        if(pFormat->Which() == RES_FLYFRMFMT && pFormat->getIDocumentLayoutAccess().GetCurrentViewShell()) // #i11176#
+        const auto& rFormat(dynamic_cast<const SwFrameFormat&>(rMod));
+        if (rFormat.Which() == RES_FLYFRMFMT && rFormat.getIDocumentLayoutAccess().GetCurrentViewShell()) // #i11176#
             pGetZOrdnerHint->m_rnZOrder = GetVirtDrawObj()->GetOrdNum();
     }
-    else if(auto pConnectedHint = dynamic_cast<const sw::GetObjectConnectedHint*>(&rHint))
+    else if (auto pConnectedHint = dynamic_cast<const sw::GetObjectConnectedHint*>(&rHint))
     {
-        auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
-        if(!pConnectedHint->m_risConnected && pFormat->Which() == RES_FLYFRMFMT && (!pConnectedHint->m_pRoot || pConnectedHint->m_pRoot == getRootFrame()))
+        const auto& rFormat(dynamic_cast<const SwFrameFormat&>(rMod));
+        if (!pConnectedHint->m_risConnected && rFormat.Which() == RES_FLYFRMFMT && (!pConnectedHint->m_pRoot || pConnectedHint->m_pRoot == getRootFrame()))
             pConnectedHint->m_risConnected = true;
     }
-};
+}
 
 void SwFlyFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
 {


More information about the Libreoffice-commits mailing list