summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-04-18 13:31:42 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-04-26 13:20:36 +0200
commit54dca662577bf7267e1d993650c353ef10a88e36 (patch)
tree9f304215757586badd79a2d2b68d388dbe709c22
parenttdf#154803 - Check if range is entirely merged (diff)
downloadcore-54dca662577bf7267e1d993650c353ef10a88e36.tar.gz
core-54dca662577bf7267e1d993650c353ef10a88e36.zip
formula: fix crash in FormulaDlg_Impl::UpdateSelection
m_pFuncDesc can be nullptr See https://crashreport.libreoffice.org/stats/signature/formula::FormulaDlg_Impl::UpdateSelection() Change-Id: If8a95bef8b0a8a03ffe63041409ee7c1cf322b0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150550 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 2d62a54d151f32007c1cb1c7f729b777dbdb73cc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150569 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--formula/source/ui/dlg/formula.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index c73543603158..5b6ef7000fe9 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1456,15 +1456,23 @@ IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaCursorHdl, weld::TextView&, void)
void FormulaDlg_Impl::UpdateSelection()
{
m_pHelper->setSelection( m_aFuncSel.Min(), m_aFuncSel.Max());
- m_pHelper->setCurrentFormula( m_pFuncDesc->getFormula( m_aArguments ) );
+ if (m_pFuncDesc)
+ {
+ m_pHelper->setCurrentFormula( m_pFuncDesc->getFormula( m_aArguments ) );
+ m_nArgs = m_pFuncDesc->getSuppressedArgumentCount();
+ }
+ else
+ {
+ m_pHelper->setCurrentFormula("");
+ m_nArgs = 0;
+ }
+
m_xMEdit->set_text(m_pHelper->getCurrentFormula());
sal_Int32 PrivStart, PrivEnd;
m_pHelper->getSelection( PrivStart, PrivEnd);
m_aFuncSel.Min() = PrivStart;
m_aFuncSel.Max() = PrivEnd;
- m_nArgs = m_pFuncDesc->getSuppressedArgumentCount();
-
OUString aFormula = m_xMEdit->get_text();
sal_Int32 nArgPos = m_aFormulaHelper.GetArgStart( aFormula, PrivStart, 0);