[Libreoffice-commits] core.git: sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun May 26 14:13:37 UTC 2019


 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |   55 ++++++++++---------
 1 file changed, 29 insertions(+), 26 deletions(-)

New commits:
commit d9f190abbcd57bf3f0e1e0041309152bf6b52459
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 26 14:18:03 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun May 26 16:12:44 2019 +0200

    Resolves: rhbz#1713827 protect against null ViewShell
    
    like SfxHintId::ScAccCursorChanged does
    
    Change-Id: I75ab2da866a345d817e39536ac966d3edf24b90a
    Reviewed-on: https://gerrit.libreoffice.org/72979
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index aeef1aec99c8..2381383d4f67 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -644,35 +644,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;
+                        }
                     }
                 }
             }


More information about the Libreoffice-commits mailing list