Blame 0001-Resolves-rhbz-1713827-protect-against-null-ViewShell.patch

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