summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-06-25 10:17:52 +0200
committerMiklos Vajna <vmiklos@collabora.com>2024-06-26 12:04:09 +0200
commitfba0193fcfb250d931c54baab2d1b79ce4be2f12 (patch)
tree7ec620ec32427480a9fc08f0892d39f080cae7b7
parent6c09c85ec384e88c89bff0817e7fe9889d7ed68e (diff)
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 <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/source/core/crsr/viscrs.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index cd8c17ff5441..7c30e8f43675 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);
}
}