sd/source/ui/view/ViewShellBase.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 6e2dfcfc0a15d45c8c9000b4e6b7883b2bf261c7
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Jan 20 17:44:50 2026 +0100
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Fri Jan 23 07:34:25 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]>
    (cherry picked from commit 10ce0a8084f94a00904d5d838a2a0df47a5be2ba)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197698
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/sd/source/ui/view/ViewShellBase.cxx 
b/sd/source/ui/view/ViewShellBase.cxx
index cceed0d4a823..48851a5e0890 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -685,9 +685,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 );
@@ -1470,9 +1471,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
                             {

Reply via email to