sd/source/ui/view/viewshel.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 665dce4442e48b133b9fe1a2eb792ed3ef81d90c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Oct 31 18:17:11 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Oct 31 22:31:38 2024 +0100

    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 <xiscofa...@libreoffice.org>

diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 68c4071b6c89..261c6aaf7701 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -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())

Reply via email to