From ffab9dc94dd82e71586e999175fe5172504df443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sun, 26 May 2019 14:18:03 +0100 Subject: [PATCH] Resolves: rhbz#1713827 protect against null ViewShell like SfxHintId::ScAccCursorChanged does Change-Id: I75ab2da866a345d817e39536ac966d3edf24b90a --- .../Accessibility/AccessibleSpreadsheet.cxx | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 269379812e6f..adbf5d041d0d 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -651,35 +651,38 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE); else mbDelIns = false; - ScViewData& rViewData = mpViewShell->GetViewData(); - ScAddress aNewCell = rViewData.GetCurPos(); - if( maActiveCell == aNewCell) + if (mpViewShell) { - ScDocument* pScDoc= GetDocument(mpViewShell); - if (pScDoc) + ScViewData& rViewData = mpViewShell->GetViewData(); + ScAddress aNewCell = rViewData.GetCurPos(); + if( maActiveCell == aNewCell) { - OUString valStr(pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab())); - if(m_strCurCellValue != valStr) - { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::VALUE_CHANGED; - mpAccCell->CommitChange(aEvent); - m_strCurCellValue=valStr; - } - OUString tabName; - pScDoc->GetName( maActiveCell.Tab(), tabName ); - if( m_strOldTabName != tabName ) + ScDocument* pScDoc= GetDocument(mpViewShell); + if (pScDoc) { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::NAME_CHANGED; - OUString sOldName(ScResId(STR_ACC_TABLE_NAME)); - sOldName = sOldName.replaceFirst("%1", m_strOldTabName); - aEvent.OldValue <<= sOldName; - OUString sNewName(ScResId(STR_ACC_TABLE_NAME)); - sOldName = sNewName.replaceFirst("%1", tabName); - aEvent.NewValue <<= sNewName; - CommitChange( aEvent ); - m_strOldTabName = tabName; + OUString valStr(pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab())); + if(m_strCurCellValue != valStr) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::VALUE_CHANGED; + mpAccCell->CommitChange(aEvent); + m_strCurCellValue=valStr; + } + OUString tabName; + pScDoc->GetName( maActiveCell.Tab(), tabName ); + if( m_strOldTabName != tabName ) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::NAME_CHANGED; + OUString sOldName(ScResId(STR_ACC_TABLE_NAME)); + sOldName = sOldName.replaceFirst("%1", m_strOldTabName); + aEvent.OldValue <<= sOldName; + OUString sNewName(ScResId(STR_ACC_TABLE_NAME)); + sOldName = sNewName.replaceFirst("%1", tabName); + aEvent.NewValue <<= sNewName; + CommitChange( aEvent ); + m_strOldTabName = tabName; + } } } } -- 2.21.0