sw/source/core/crsr/viscrs.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 7899d277cdd790303ffea309c8b717cc668e272a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Jun 25 10:17:52 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jun 26 15:45:10 2024 +0200

    sw: fix crash in SwShellCursor::Show()
    
    Crashreport signature:
    
    > Fatal signal received: SIGSEGV code: 1 for address: 0x0
    > program/libswlo.so
    >       SwShellCursor::Show(SfxViewShell const*)
    >               sw/source/core/crsr/viscrs.cxx:991
    > program/libswlo.so
    >       SwCursorShell::ShowCursors(bool)
    >               sw/source/core/crsr/crsrsh.cxx:2769
    > program/libswlo.so
    >       SwViewShell::ImplEndAction(bool)
    >               sw/source/core/view/viewsh.cxx:?
    > program/libswlo.so
    >       SwViewShell::EndAction(bool)
    >               sw/inc/viewsh.hxx:638
    
    (cherry picked from commit cefe556b9198b5dba18256d30ddcfcfda03f18c8)
    
    Change-Id: I31e453fae20957b906ff82f967dd97bb571d58d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169538
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit fba0193fcfb250d931c54baab2d1b79ce4be2f12)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169552

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 8a69bc597be2..a30492476844 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -988,7 +988,19 @@ void SwShellCursor::Show(SfxViewShell const * pViewShell)
     }
     else
     {
-        
GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION,
 sRect);
+        const SwCursorShell* pShell = GetShell();
+        if (!pShell)
+        {
+            return;
+        }
+
+        SfxViewShell* pSfxViewShell = pShell->GetSfxViewShell();
+        if (!pSfxViewShell)
+        {
+            return;
+        }
+
+        pSfxViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
sRect);
         SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
     }
 }

Reply via email to