summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-02-17 15:50:29 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2023-02-20 11:25:56 +0000
commitc0181b2f26b784d8317f51a77a9dfade16913ad1 (patch)
tree267bf1cd961ac40116d5d4398e6be029fcfac304
parentacd44070a5fae1bbeec063acc8a68463d914529d (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 (cherry picked from commit b905b793be520b9fdece8d12614566be82ce3c92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147312 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--starmath/source/cursor.cxx4
-rw-r--r--starmath/source/dialog.cxx7
-rw-r--r--starmath/source/document.cxx8
3 files changed, 10 insertions, 9 deletions
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 52621d360c80..d5479ab42765 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -1315,8 +1315,8 @@ void SmCursor::EndEdit(){
}
void SmCursor::RequestRepaint(){
- SmViewShell *pViewSh = SmGetActiveView();
- if( pViewSh ) {
+ if (SmViewShell *pViewSh = SmGetActiveView())
+ {
if ( SfxObjectCreateMode::EMBEDDED == mpDocShell->GetCreateMode() )
mpDocShell->Repaint();
else
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 043739cf5c0d..19992b341c36 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 23034ede3e3c..59353879d4e4 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -159,7 +159,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() )
@@ -256,8 +256,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
{
@@ -542,8 +541,7 @@ void SmDocShell::Repaint()
Size aVisSize = GetSize();
SetVisAreaSize(aVisSize);
- SmViewShell* pViewSh = SmGetActiveView();
- if (pViewSh)
+ if (SmViewShell* pViewSh = SmGetActiveView())
pViewSh->GetGraphicWidget().Invalidate();
if (bIsEnabled)