From a28ad8c96a6777fba734a4cc50c4fc56736dbaee Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 24 Jan 2015 14:30:05 +0000 Subject: coverity#1265798 Dereference null return value Change-Id: Ic4a9a42bafdc72be3de067b5f47dc98f0250f575 --- sd/source/ui/func/fudraw.cxx | 2 +- sd/source/ui/view/drviews6.cxx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index 20ea07c795cf..ce1662921501 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -523,7 +523,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) mpViewShell->GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())) { // pipette mode - SfxChildWindow* pWnd = mpViewShell->GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); + SfxChildWindow* pWnd = mpViewShell->GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); SvxBmpMask* pMask = pWnd ? static_cast(pWnd->GetWindow()) : NULL; if (pMask && pMask->IsEyedropping()) { diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 9660b441e5f3..d1340419abd8 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -301,21 +301,21 @@ void DrawViewShell::ExecBmpMask( SfxRequest& rReq ) } } - if( bCont ) + SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow( + SvxBmpMaskChildWindow::GetChildWindowId()); + SvxBmpMask* pBmpMask = pWnd ? static_cast(pWnd->GetWindow()) : NULL; + assert(pBmpMask); + if (bCont && pBmpMask) { const Graphic& rOldGraphic = pNewObj->GetGraphic(); - const Graphic aNewGraphic( static_cast( GetViewFrame()->GetChildWindow( - SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )-> - Mask( rOldGraphic ) ); + const Graphic aNewGraphic(pBmpMask->Mask(rOldGraphic)); if( aNewGraphic != rOldGraphic ) { SdrPageView* pPV = mpDrawView->GetSdrPageView(); pNewObj->SetEmptyPresObj( false ); - pNewObj->SetGraphic( static_cast( GetViewFrame()->GetChildWindow( - SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )-> - Mask( pNewObj->GetGraphic() ) ); + pNewObj->SetGraphic(pBmpMask->Mask(pNewObj->GetGraphic())); OUString aStr( mpDrawView->GetDescriptionOfMarkedObjects() ); aStr += " " + SD_RESSTR(STR_EYEDROPPER); -- cgit