diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-03-21 16:55:59 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-03-22 12:03:50 +0000 |
commit | 74f398bb58510087cc4a11bb2253715771a2c6b2 (patch) | |
tree | 617b374a33d8fcd67be2e74225dbc3ef1d9159d0 /sw/source/ui/fldui | |
parent | d41c3c820dad7c78bc57815e0f4a6999d125561d (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.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldtdlg.cxx | 3 |
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()) |