diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-11 20:04:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-11 21:05:59 +0100 |
commit | 0a49132cd064272442ca7500476e2346dc0aa4cd (patch) | |
tree | 33dff5f7e5ef5b472f39607b2692508ca929764e | |
parent | ad1bb28b25d24772e06c1d45e8ea8853702a1c10 (diff) |
coverity#705918 Dereference before null check
Change-Id: Ic36d335f06833e830c97ca34b7d96c5ff421f944
-rw-r--r-- | sw/source/core/draw/dpage.cxx | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index 64692a8d6f0c..d98bfd4d9929 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -84,38 +84,35 @@ const SdrPageGridFrameList* SwDPage::GetGridFrameList( const SdrPageView* pPV, const Rectangle *pRect ) const { SwViewShell *pSh = ((SwDrawDocument*)GetModel())->GetDoc().GetCurrentViewShell(); - if ( pSh ) + while (pSh && pSh->Imp()->GetPageView() != pPV) + pSh = (SwViewShell*)pSh->GetNext(); + if (pSh) { - while ( pSh->Imp()->GetPageView() != pPV ) - pSh = (SwViewShell*)pSh->GetNext(); - if ( pSh ) - { - if ( pGridLst ) - ((SwDPage*)this)->pGridLst->Clear(); - else - ((SwDPage*)this)->pGridLst = new SdrPageGridFrameList; + if ( pGridLst ) + ((SwDPage*)this)->pGridLst->Clear(); + else + ((SwDPage*)this)->pGridLst = new SdrPageGridFrameList; - if ( pRect ) - { - //The drawing demands all pages which overlap with the rest. - const SwRect aRect( *pRect ); - const SwFrm *pPg = pSh->GetLayout()->Lower(); + if ( pRect ) + { + //The drawing demands all pages which overlap with the rest. + const SwRect aRect( *pRect ); + const SwFrm *pPg = pSh->GetLayout()->Lower(); + do + { if ( pPg->Frm().IsOver( aRect ) ) + ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg ); + pPg = pPg->GetNext(); + } while ( pPg ); + } + else + { + //The drawing demands all visible pages + const SwFrm *pPg = pSh->Imp()->GetFirstVisPage(); + if ( pPg ) do - { if ( pPg->Frm().IsOver( aRect ) ) - ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg ); + { ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg ); pPg = pPg->GetNext(); - } while ( pPg ); - } - else - { - //The drawing demands all visible pages - const SwFrm *pPg = pSh->Imp()->GetFirstVisPage(); - if ( pPg ) - do - { ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg ); - pPg = pPg->GetNext(); - } while ( pPg && pPg->Frm().IsOver( pSh->VisArea() ) ); - } + } while ( pPg && pPg->Frm().IsOver( pSh->VisArea() ) ); } } return pGridLst; |