diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-12-16 09:53:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 14:52:02 +0000 |
commit | bc30e84919b698b2d3b5a7330fbf646708b55d3d (patch) | |
tree | 86bcab989f703c05da59e928a2dd9ce66ac826f0 /sc | |
parent | d5ac3a4a655aa236ac2ecf93e247f4ac98a45233 (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/+/144302
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 14f0bc4a4615..8b8220106b35 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1177,11 +1177,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: |