summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-12-16 09:53:21 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-12-16 15:25:00 +0000
commitef52648227557461bcc1224a5af6eaebce2faae7 (patch)
tree9f093bff1f0075bf0e84893bfc560c749dfa2580 /sc
parentc782cc8961fa514b636547dbd0a23dab3f90146b (diff)
sc: fix null deref in ScDocShell::Execute
See https://crashreport.libreoffice.org/stats/signature/ScViewData::GetDispatcher() Change-Id: I3271738b3c7f456adad1309c52195d98646f1acc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144291 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/docsh4.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 04b605edb57a..494057b12087 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1180,11 +1180,15 @@ void ScDocShell::Execute( SfxRequest& rReq )
#endif
case SID_OPEN_CALC:
{
- SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.sheet.SpreadsheetDocument");
- SfxStringItem aTarget(SID_TARGETNAME, "_blank");
- GetViewData()->GetDispatcher().ExecuteList(
- SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON,
- { &aApp, &aTarget });
+ ScViewData* pViewData = GetViewData();
+ if (pViewData)
+ {
+ SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.sheet.SpreadsheetDocument");
+ SfxStringItem aTarget(SID_TARGETNAME, "_blank");
+ pViewData->GetDispatcher().ExecuteList(
+ SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON,
+ { &aApp, &aTarget });
+ }
}
break;
case SID_NOTEBOOKBAR: