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

Eike Rathke erack at redhat.com
Wed Jun 21 15:43:48 UTC 2017


 sc/source/ui/view/viewdata.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 87cbbdc98d78c3c15f7161de6fec93d8680ee1de
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 21 17:42:42 2017 +0200

    Resolves: tdf#108654 check nTabNo against maTabData size
    
    ScViewData::DeleteTab() and DeleteTabs() never did that and worked by accident
    for which commit 73dec49802ef8fc42c5719efaa42a33cde68e569 removed the
    grounding..
    
    Change-Id: I95460cd017d558c073df7891551d0251009dc1d4

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 63257497cb7c..ceffc1973dca 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -545,6 +545,11 @@ void ScViewData::DeleteTab( SCTAB nTab )
     delete maTabData.at(nTab);
 
     maTabData.erase(maTabData.begin() + nTab);
+    if (static_cast<size_t>(nTabNo) >= maTabData.size())
+    {
+        EnsureTabDataSize(1);
+        nTabNo = maTabData.size() - 1;
+    }
     UpdateCurrentTab();
     mpMarkData->DeleteTab( nTab );
 }
@@ -558,6 +563,11 @@ void ScViewData::DeleteTabs( SCTAB nTab, SCTAB nSheets )
     }
 
     maTabData.erase(maTabData.begin() + nTab, maTabData.begin()+ nTab+nSheets);
+    if (static_cast<size_t>(nTabNo) >= maTabData.size())
+    {
+        EnsureTabDataSize(1);
+        nTabNo = maTabData.size() - 1;
+    }
     UpdateCurrentTab();
 }
 


More information about the Libreoffice-commits mailing list