diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-17 15:50:29 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-17 18:20:07 +0000 |
commit | a7fd1e067eb2af0ef329719c4c7dbb32cc5926b2 (patch) | |
tree | 446cda72466b8faa2efb9a0dbf14b04d2a4d7fbc | |
parent | 9d91fbba6f374fa1c10b38eae003da89bd4e6d4b (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>
-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 2ffe14a816bf..19d5b4352b1b 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 0e43fa1d6efb..51b548032f1c 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) |