tdf#163486: PVS: check GetView

V1004 	The 'GetView()' pointer was used unsafely after it was verified against nullptr. Check lines: 596, 606.

Change-Id: I4bf5366f49794c2956b0f704c32829c9dac6d5b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175883
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2024-10-31 18:17:11 +01:00
parent 5c930b7e68
commit 665dce4442

View file

@ -592,18 +592,20 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
SetActiveWindow(pWin);
}
::sd::View* pView = GetView();
if (!pView)
return;
// insert MouseEvent into E3dView
if (GetView() != nullptr)
GetView()->SetMouseEvent(rMEvt);
pView->SetMouseEvent(rMEvt);
bool bConsumed = false;
if( GetView() )
bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt );
bConsumed = pView->getSmartTags().MouseButtonDown( rMEvt );
if( bConsumed )
return;
rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
rtl::Reference< sdr::SelectionController > xSelectionController( pView->getSelectionController() );
if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) )
{
if(HasCurrentFunction())