sd/source/ui/view/ViewShellBase.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
New commits: commit 10ce0a8084f94a00904d5d838a2a0df47a5be2ba Author: Xisco Fauli <[email protected]> AuthorDate: Tue Jan 20 17:44:50 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Jan 20 21:03:49 2026 +0100 crashreporting: check GetViewShell() Seen in https://crashreport.libreoffice.org/stats/crash_details/a6b63eaa-ffe7-400e-8363-8c5dc665d59f Since commit 01b1e0f172c1912dac24337692d85a9caf637d9a Author: Heiko Tietze <[email protected]> Date: Wed Mar 26 09:52:55 2025 +0100 Resolves tdf#84375 - Commands to protect image size and position Change-Id: I75b7b82d369cad58e1e4ee0528be30399c9bb619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197681 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index e86685b35fda..2994a7f90aa1 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -679,9 +679,10 @@ void ViewShellBase::Execute (SfxRequest& rRequest) case SID_PROTECTSIZE: { ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); - if (!pDocSh) + ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; + ::sd::View* pView = pViewSh ? pViewSh->GetView() : nullptr; + if (!pView) break; - ::sd::View* pView = pDocSh->GetViewShell()->GetView(); const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); assert ( rMarkList.GetMarkCount() == 1 ); @@ -1458,9 +1459,10 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) case SID_PROTECTSIZE: { ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell*>(SfxObjectShell::Current()); - if (pDocSh) + ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr; + ::sd::View* pView = pViewSh ? pViewSh->GetView() : nullptr; + if (pView) { - ::sd::View* pView = pDocSh->GetViewShell()->GetView(); const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); if ( rMarkList.GetMarkCount() == 1 ) // graphic menu only effective on single item {
