summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-10-03 19:00:35 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-10-04 14:56:50 +0200
commit2fd53f90ae83a978a3f5e715d5e790fa1b4add00 (patch)
treeeaf7e7fb8d61db6b9418ed3810e78d5576382c3c
parentvcl: fix crash in SalInstanceWidget::set_busy_cursor() (diff)
downloadcore-2fd53f90ae83a978a3f5e715d5e790fa1b4add00.tar.gz
core-2fd53f90ae83a978a3f5e715d5e790fa1b4add00.zip
sw: fix crash in SwParagraphNumTabPage::ExecuteEditNumStyle_Impl
SfxViewShell::Current() could be nullptr See https://crashreport.libreoffice.org/stats/signature/SfxShell::GetDispatcher() Change-Id: Ic2ffc2a35eff8b8acbb896ece198916ee074b019 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140889 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit cf15a1fc143536c20c81faab5950ab829ec8df19) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140892
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx14
-rw-r--r--sw/source/uibase/inc/numpara.hxx2
2 files changed, 9 insertions, 7 deletions
diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
index 205bcacadb6f..272c7161e869 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -307,10 +307,15 @@ IMPL_LINK_NOARG(SwParagraphNumTabPage, EditNumStyleHdl_Impl, weld::Button&, void
}
// Internal: Perform functions through the Dispatcher
-bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl(
+void SwParagraphNumTabPage::ExecuteEditNumStyle_Impl(
sal_uInt16 nId, const OUString &rStr, SfxStyleFamily nFamily)
{
- SfxDispatcher &rDispatcher = *SfxViewShell::Current()->GetDispatcher();
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+
+ if( !pViewShell)
+ return;
+
+ SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
SfxStringItem aItem(nId, rStr);
SfxUInt16Item aFamily(SID_STYLE_FAMILY, static_cast<sal_uInt16>(nFamily));
const SfxPoolItem* pItems[ 3 ];
@@ -329,12 +334,9 @@ bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl(
pInternalItems[ 0 ] = &aDialogParent;
pInternalItems[ 1 ] = nullptr;
- const SfxPoolItem* pItem = rDispatcher.Execute(
+ pDispatcher->Execute(
nId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
pItems, 0, pInternalItems);
-
- return pItem != nullptr;
-
}
IMPL_LINK(SwParagraphNumTabPage, StyleHdl_Impl, weld::ComboBox&, rBox, void)
diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx
index cf43a1b6b155..19fea5b15b94 100644
--- a/sw/source/uibase/inc/numpara.hxx
+++ b/sw/source/uibase/inc/numpara.hxx
@@ -58,7 +58,7 @@ class SwParagraphNumTabPage final : public SfxTabPage
static const WhichRangesContainer aPageRg;
- bool ExecuteEditNumStyle_Impl(sal_uInt16 nId, const OUString& rStr,
+ void ExecuteEditNumStyle_Impl(sal_uInt16 nId, const OUString& rStr,
SfxStyleFamily nFamily);
public: