summaryrefslogtreecommitdiff
path: root/sw/source/ui/fldui
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-03-21 16:55:59 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-03-22 12:03:50 +0000
commit74f398bb58510087cc4a11bb2253715771a2c6b2 (patch)
tree617b374a33d8fcd67be2e74225dbc3ef1d9159d0 /sw/source/ui/fldui
parentd41c3c820dad7c78bc57815e0f4a6999d125561d (diff)
sw: check GetActiveView()
See https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell() Change-Id: I90ebbff5082f1f9cae7fa3b940cbb9796d6c6dd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149223 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/source/ui/fldui')
-rw-r--r--sw/source/ui/fldui/fldpage.cxx4
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx3
2 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index f83c9b75e69a..dfdd77f5db66 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -118,8 +118,10 @@ void SwFieldPage::InsertField(SwFieldTypesEnum nTypeId, sal_uInt16 nSubType, con
sal_Unicode cSeparator, bool bIsAutomaticLanguage)
{
SwView* pView = GetActiveView();
- SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr();
+ if (!pView)
+ return;
+ SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr();
if (!pSh)
return;
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 9f81d6841ef4..487bfa8cc0c2 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -221,7 +221,7 @@ void SwFieldDlg::ReInitTabPage(std::string_view rPageId, bool bOnlyActivate)
// newly initialise after activation of a few TabPages
void SwFieldDlg::Activate()
{
- SwView* pView = ::GetActiveView();
+ SwView* pView = GetActiveView();
if( !pView )
return;
@@ -246,7 +246,6 @@ void SwFieldDlg::EnableInsert(bool bEnable)
if( bEnable )
{
SwView* pView = ::GetActiveView();
- OSL_ENSURE(pView, "no view found");
if( !pView ||
(pView->GetWrtShell().IsReadOnlyAvailable() &&
pView->GetWrtShell().HasReadonlySel())