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

Caolán McNamara caolanm at redhat.com
Sun Nov 26 20:27:54 UTC 2017


 filter/source/msfilter/msdffimp.cxx |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit fc8e7168b5d991d10dc556b5bf90efaa5d9c949e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Nov 26 13:18:04 2017 +0000

    ofz#4435 Bad-cast
    
    Change-Id: Ie0364c758af84097cee93e4f6c5e8af2816359d4
    Reviewed-on: https://gerrit.libreoffice.org/45285
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index eac8803da7f4..9c3a8f6a10ee 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4100,11 +4100,15 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                         return pRet;
                     sal_Int32 nShapeId;
                     SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId );
-                    if ( pTmp && pRet && static_cast<SdrObjGroup*>(pRet)->GetSubList() )
+                    if (pTmp)
                     {
-                        static_cast<SdrObjGroup*>(pRet)->GetSubList()->NbcInsertObject( pTmp );
-                        if( nShapeId )
-                            insertShapeId( nShapeId, pTmp );
+                        SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pRet);
+                        if (pGroup && pGroup->GetSubList())
+                        {
+                            pGroup->GetSubList()->NbcInsertObject(pTmp);
+                            if (nShapeId)
+                                insertShapeId(nShapeId, pTmp);
+                        }
                     }
                 }
                 else if ( aRecHd2.nRecType == DFF_msofbtSpContainer )
@@ -4113,11 +4117,15 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                         return pRet;
                     sal_Int32 nShapeId;
                     SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId );
-                    if ( pTmp && pRet && static_cast<SdrObjGroup*>(pRet)->GetSubList())
+                    if (pTmp)
                     {
-                        static_cast<SdrObjGroup*>(pRet)->GetSubList()->NbcInsertObject( pTmp );
-                        if( nShapeId )
-                            insertShapeId( nShapeId, pTmp );
+                        SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pRet);
+                        if (pGroup && pGroup->GetSubList())
+                        {
+                            pGroup->GetSubList()->NbcInsertObject(pTmp);
+                            if (nShapeId)
+                                insertShapeId(nShapeId, pTmp);
+                        }
                     }
                 }
                 if (!aRecHd2.SeekToEndOfRecord(rSt))


More information about the Libreoffice-commits mailing list