formula/source/ui/dlg/formula.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
New commits: commit 2d62a54d151f32007c1cb1c7f729b777dbdb73cc Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Apr 18 13:31:42 2023 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Apr 18 15:05:46 2023 +0200 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 <caol...@redhat.com> diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 65301ac0450c..c12534268131 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);