diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-17 15:50:29 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-02-25 22:33:39 +0100 |
commit | d9cc9e7d393fa3a7541b859378dae24c4dbec65c (patch) | |
tree | b707924dee7c8bd4c632db09581f9afbe4e757f4 | |
parent | 8eea0c394e3bf6e66b9eb145ea1e8bc82d3a8d96 (diff) |
check SmGetActiveView()
it might be null
See https://crashreport.libreoffice.org/stats/signature/SmPrintOptionsTabPage::~SmPrintOptionsTabPage()
Change-Id: I7bc17da230784e6e3fc9c0b33848423ac113ab29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147221
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit a7fd1e067eb2af0ef329719c4c7dbb32cc5926b2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147246
-rw-r--r-- | starmath/source/cursor.cxx | 7 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 7 | ||||
-rw-r--r-- | starmath/source/document.cxx | 8 |
3 files changed, 12 insertions, 10 deletions
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index c7c27616b3f9..e8623517bcd7 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1330,9 +1330,10 @@ void SmCursor::EndEdit(){ mpDocShell->GetEditEngine().QuickFormatDoc(); } -void SmCursor::RequestRepaint(){ - SmViewShell *pViewSh = SmGetActiveView(); - if( pViewSh ) { +void SmCursor::RequestRepaint() +{ + if (SmViewShell *pViewSh = SmGetActiveView()) + { if (comphelper::LibreOfficeKit::isActive()) { pViewSh->SendCaretToLOK(); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 2aedbae19d05..e7450727ad61 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -181,7 +181,8 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(weld::Container* pPage, weld::Dialo SmPrintOptionsTabPage::~SmPrintOptionsTabPage() { - SmGetActiveView()->GetEditWindow()->UpdateStatus(); + if (SmViewShell *pViewSh = SmGetActiveView()) + pViewSh->GetEditWindow()->UpdateStatus(); } bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) @@ -204,7 +205,9 @@ bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) rSet->Put(SfxBoolItem(SID_AUTO_CLOSE_BRACKETS, m_xAutoCloseBrackets->get_active())); rSet->Put(SfxUInt16Item(SID_SMEDITWINDOWZOOM, sal::static_int_cast<sal_uInt16>(m_xSmZoom->get_value(FieldUnit::PERCENT)))); - SmGetActiveView()->GetEditWindow()->UpdateStatus(); + if (SmViewShell *pViewSh = SmGetActiveView()) + pViewSh->GetEditWindow()->UpdateStatus(); + return true; } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index e7c5dee90c4d..0593d26c268c 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -150,7 +150,7 @@ void SmDocShell::SetText(const OUString& rBuffer) Parse(); SmViewShell *pViewSh = SmGetActiveView(); - if( pViewSh ) + if (pViewSh) { pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_TEXT); if ( SfxObjectCreateMode::EMBEDDED == GetCreateMode() ) @@ -247,8 +247,7 @@ void SmDocShell::ArrangeFormula() // if necessary get another OutputDevice for which we format if (!pOutDev) { - SmViewShell *pView = SmGetActiveView(); - if (pView) + if (SmViewShell *pView = SmGetActiveView()) pOutDev = &pView->GetGraphicWidget().GetDrawingArea()->get_ref_device(); else { @@ -533,8 +532,7 @@ void SmDocShell::Repaint() Size aVisSize = GetSize(); SetVisAreaSize(aVisSize); - SmViewShell* pViewSh = SmGetActiveView(); - if (pViewSh) + if (SmViewShell* pViewSh = SmGetActiveView()) pViewSh->GetGraphicWidget().Invalidate(); if (bIsEnabled) |