Kaydet (Commit) 0a49132c authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#705918 Dereference before null check

Change-Id: Ic36d335f06833e830c97ca34b7d96c5ff421f944
üst ad1bb28b
...@@ -84,38 +84,35 @@ const SdrPageGridFrameList* SwDPage::GetGridFrameList( ...@@ -84,38 +84,35 @@ const SdrPageGridFrameList* SwDPage::GetGridFrameList(
const SdrPageView* pPV, const Rectangle *pRect ) const const SdrPageView* pPV, const Rectangle *pRect ) const
{ {
SwViewShell *pSh = ((SwDrawDocument*)GetModel())->GetDoc().GetCurrentViewShell(); 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 ) if ( pGridLst )
pSh = (SwViewShell*)pSh->GetNext(); ((SwDPage*)this)->pGridLst->Clear();
if ( pSh ) else
{ ((SwDPage*)this)->pGridLst = new SdrPageGridFrameList;
if ( pGridLst )
((SwDPage*)this)->pGridLst->Clear();
else
((SwDPage*)this)->pGridLst = new SdrPageGridFrameList;
if ( pRect ) if ( pRect )
{ {
//The drawing demands all pages which overlap with the rest. //The drawing demands all pages which overlap with the rest.
const SwRect aRect( *pRect ); const SwRect aRect( *pRect );
const SwFrm *pPg = pSh->GetLayout()->Lower(); 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 do
{ if ( pPg->Frm().IsOver( aRect ) ) { ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
pPg = pPg->GetNext(); pPg = pPg->GetNext();
} while ( pPg ); } while ( pPg && pPg->Frm().IsOver( pSh->VisArea() ) );
}
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() ) );
}
} }
} }
return pGridLst; return pGridLst;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment