diff options
author | Noel Grandin <noel@peralex.com> | 2014-02-19 13:14:34 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-02-20 09:31:11 +0200 |
commit | 5212847db843396ff87eb3b29eade19db1e883a2 (patch) | |
tree | 486ee55ceade519751964beacfa7d7e0d1f25bef | |
parent | 97a185d8b98976d638742d8a35a83597d239c678 (diff) |
cid#1028109 Dereference before null check
Change-Id: I2049cccef41eded984466856f2d928abafa00237
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 36dc6da52ecf..fecf9f735251 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2570,42 +2570,38 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) if (pRecord->bHidden) return 0; - if(pObject) + sal_uInt16 nCount = pObject->GetUserDataCount(); + if(nCount) { - sal_uInt16 nCount = pObject->GetUserDataCount(); - if(nCount) + OUString lnName, aObjName, aTarFrm; + for (sal_uInt16 i = 0; i < nCount; i++ ) { - OUString lnName, aObjName, aTarFrm; - for (sal_uInt16 i = 0; i < nCount; i++ ) + SdrObjUserData* pData = pObject->GetUserData( i ); + if( pData && pData->GetInventor() == SW_DRAWLAYER + && pData->GetId() == SW_UD_IMAPDATA) { - SdrObjUserData* pData = pObject->GetUserData( i ); - if( pData && pData->GetInventor() == SW_DRAWLAYER - && pData->GetId() == SW_UD_IMAPDATA) + SwMacroInfo* macInf = dynamic_cast<SwMacroInfo*>(pData); + if( macInf )// && macInf->GetShapeId() == pF->nSpId) { - SwMacroInfo* macInf = dynamic_cast<SwMacroInfo*>(pData); - - if( macInf )// && macInf->GetShapeId() == pF->nSpId) + sal_Int32 nShapeId = macInf->GetShapeId(); + if ( nShapeId == pF->nSpId ) { - sal_Int32 nShapeId = macInf->GetShapeId(); - if ( nShapeId == pF->nSpId ) - { - lnName = macInf->GetHlink(); - aObjName = macInf->GetName(); - aTarFrm = macInf->GetTarFrm(); - break; - } + lnName = macInf->GetHlink(); + aObjName = macInf->GetName(); + aTarFrm = macInf->GetTarFrm(); + break; } } } - SwFmtURL* pFmtURL = new SwFmtURL(); - pFmtURL->SetURL( lnName, false ); - if (!aObjName.isEmpty()) - pFmtURL->SetName(aObjName); - if (!aTarFrm.isEmpty()) - pFmtURL->SetTargetFrameName(aTarFrm); - pFmtURL->SetMap(0); - aFlySet.Put(*pFmtURL); } + SwFmtURL* pFmtURL = new SwFmtURL(); + pFmtURL->SetURL( lnName, false ); + if (!aObjName.isEmpty()) + pFmtURL->SetName(aObjName); + if (!aTarFrm.isEmpty()) + pFmtURL->SetTargetFrameName(aTarFrm); + pFmtURL->SetMap(0); + aFlySet.Put(*pFmtURL); } // If we are to be "below text" then we are not to be opaque |