summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-02-20 16:29:19 +0100
committerAndras Timar <andras.timar@collabora.com>2023-02-25 22:33:40 +0100
commit9cac316ce760dd0cc9f95c07b1a6c4731b0ebeba (patch)
tree580e3b6bd33bb72c73d5b9248ca79102d8be71d8 /sw/source/ui
parent0444b752b34f42460d6b5c2866f35de803918c56 (diff)
sw: check GetWrtShellPtr()
Change-Id: I8d99e9108f6163eafb7576603826f8d02a0ff416 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147336 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 6cb076f6b08668cf2a0490fe17ce34e74969702a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147362 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/fldui/fldpage.cxx3
-rw-r--r--sw/source/ui/misc/pggrid.cxx3
2 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 71ff3d33246e..0ba0d536a78d 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -120,6 +120,9 @@ void SwFieldPage::InsertField(SwFieldTypesEnum nTypeId, sal_uInt16 nSubType, con
SwView* pView = GetActiveView();
SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr();
+ if (!pSh)
+ return;
+
if (!IsFieldEdit()) // insert new field
{
SwInsertField_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, nullptr, cSeparator, bIsAutomaticLanguage );
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 4d26eead12d9..1e5f11332e67 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -93,8 +93,7 @@ SwTextGridPage::SwTextGridPage(weld::Container* pPage, weld::DialogController* p
SwView *pView = ::GetActiveView();
if( pView )
{
- SwWrtShell* pSh = pView->GetWrtShellPtr();
- if( pSh )
+ if (SwWrtShell* pSh = pView->GetWrtShellPtr())
{
m_bSquaredMode = pSh->GetDoc()->IsSquaredPageMode();
}