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 <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2024-10-31 18:04:20 +01:00
parent de4ef35350
commit 5c930b7e68

View file

@ -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,