diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-18 01:48:35 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-18 08:46:38 +0200 |
commit | a21b9064e89306404c467b354a1bbff20efbe6a3 (patch) | |
tree | 4e0c486327c5533029f28137d486838f131de4bf | |
parent | 954f061b93c9b8bc441af498dc19aaa1afcba791 (diff) |
tdf#163486: PVS: check GetView()
V595 The 'GetView()' pointer was utilized before it was verified against nullptr. Check lines: 518, 531.
Change-Id: I9c6ebccabece0923702e6a8fb4ee6beb9b6dc198
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175114
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 76e6c83d0ce4..68c4071b6c89 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -515,47 +515,49 @@ bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) OSL_ASSERT(GetViewShell() != nullptr); bReturn = GetViewShell()->KeyInput(rKEvt); - const SdrMarkList& rMarkList = GetView()->GetMarkedObjectList(); - const size_t OriCount = rMarkList.GetMarkCount(); - if(!bReturn) + if (sd::View* pView = GetView()) { - if(useInputForSlideShow()) //IASS + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + const size_t OriCount = rMarkList.GetMarkCount(); + if(!bReturn) { - // use for SlideShow - rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); - bReturn = xSlideShow->keyInput(rKEvt); - } - else - { - bool bConsumed = false; - if( GetView() ) - bConsumed = GetView()->getSmartTags().KeyInput(rKEvt); - - if( !bConsumed ) + if(useInputForSlideShow()) //IASS { - rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() ); - if( !xSelectionController.is() || !xSelectionController->onKeyInput( rKEvt, pWin ) ) - { - if(HasCurrentFunction()) - bReturn = GetCurrentFunction()->KeyInput(rKEvt); - } - else + // use for SlideShow + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); + bReturn = xSlideShow->keyInput(rKEvt); + } + else + { + bool bConsumed = false; + bConsumed = pView->getSmartTags().KeyInput(rKEvt); + + if( !bConsumed ) { - bReturn = true; - if (HasCurrentFunction()) + rtl::Reference< sdr::SelectionController > xSelectionController( pView->getSelectionController() ); + if( !xSelectionController.is() || !xSelectionController->onKeyInput( rKEvt, pWin ) ) { - FuText* pTextFunction = dynamic_cast<FuText*>(GetCurrentFunction().get()); - if(pTextFunction != nullptr) - pTextFunction->InvalidateBindings(); + if(HasCurrentFunction()) + bReturn = GetCurrentFunction()->KeyInput(rKEvt); + } + else + { + bReturn = true; + if (HasCurrentFunction()) + { + FuText* pTextFunction = dynamic_cast<FuText*>(GetCurrentFunction().get()); + if(pTextFunction != nullptr) + pTextFunction->InvalidateBindings(); + } } } } } + const size_t EndCount = rMarkList.GetMarkCount(); + // Here, oriCount or endCount must have one value=0, another value > 0, then to switch focus between Document and shape objects + if(bReturn && (OriCount + EndCount > 0) && (OriCount * EndCount == 0)) + SwitchActiveViewFireFocus(); } - const size_t EndCount = rMarkList.GetMarkCount(); - // Here, oriCount or endCount must have one value=0, another value > 0, then to switch focus between Document and shape objects - if(bReturn && (OriCount + EndCount > 0) && (OriCount * EndCount == 0)) - SwitchActiveViewFireFocus(); if(!bReturn && GetActiveWindow()) { |