sd/source/ui/view/Outliner.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
New commits: commit 5c930b7e68998dfc9cfc1c10ea065c307e6608c3 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Oct 31 18:04:20 2024 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Oct 31 22:25:35 2024 +0100 tdf#163486: PVS: check getViewShellBase V522 There might be dereferencing of a potential null pointer 'getViewShellBase()'. Change-Id: I19becd2a40a7e996b6634c20df309d171ebbaf1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175882 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 9aa7b6e516bc..38b3128affb1 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1756,17 +1756,19 @@ void SdOutliner::EnterEditMode (bool bGrabFocus) } else { - std::shared_ptr<sd::ViewShell> pOverridingViewShell{}; - sd::ViewShellBase* pBase = getViewShellBase(); - if (auto pViewShellManager = pBase->GetViewShellManager()) - pOverridingViewShell = pViewShellManager->GetOverridingMainShell(); - - if (pOverridingViewShell) + if (sd::ViewShellBase* pBase = getViewShellBase()) { - auto pMainViewShell = getViewShellBase()->GetMainViewShell().get(); - pMainViewShell->GetParentWindow()->GrabFocus(); - pMainViewShell->GetContentWindow()->GrabFocus(); - bGrabFocus = true; + std::shared_ptr<sd::ViewShell> pOverridingViewShell{}; + if (auto pViewShellManager = pBase->GetViewShellManager()) + pOverridingViewShell = pViewShellManager->GetOverridingMainShell(); + + if (pOverridingViewShell) + { + auto pMainViewShell = pBase->GetMainViewShell().get(); + pMainViewShell->GetParentWindow()->GrabFocus(); + pMainViewShell->GetContentWindow()->GrabFocus(); + bGrabFocus = true; + } } mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView,