From a79318470e63059309db4fe6ba92942cfac517a9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 24 Jan 2015 14:41:33 +0000 Subject: coverity#1265811 Dereference null return value Change-Id: I975c8c28f00b364f57366ea2847f8bd155c12733 --- sd/source/ui/view/drviews4.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 4552403c82e6..4acf5edc2770 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -369,7 +369,14 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) ShowMousePosInfo(aRect, pWin); - if ( mbPipette && GetViewFrame()->HasChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() ) ) + SvxBmpMask* pBmpMask = NULL; + if (mbPipette && GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())) + { + SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()); + pBmpMask = pWnd ? static_cast(pWnd->GetWindow()) : NULL; + } + + if (pBmpMask) { const long nStartX = maMousePos.X() - PIPETTE_RANGE; const long nEndX = maMousePos.X() + PIPETTE_RANGE; @@ -392,8 +399,7 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) } } - static_cast( GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )-> - SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ), + pBmpMask->SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ), (sal_uInt8) ( nGreen / fDiv + .5 ), (sal_uInt8) ( nBlue / fDiv + .5 ) ) ); } -- cgit