sc/source/ui/view/viewdata.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit 7b10f44e5c1d2a30837d906d0b2c9e9e39b31288 Author: Eike Rathke <[email protected]> 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.. squash this into it too: assert(nTab < static_cast<SCTAB>(maTabData.size())); cause of tdf#108796 Have a dev friendly abort instead of a deep throw in case of the unexpected. Change-Id: I95460cd017d558c073df7891551d0251009dc1d4 Reviewed-on: https://gerrit.libreoffice.org/56261 Reviewed-by: Aron Budea <[email protected]> Tested-by: Aron Budea <[email protected]> (cherry picked from commit abe9a9b023d1b08384f2f529e442e9a59de10f8c) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index d2e5b461e9ed..b1b092d85fd3 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -903,9 +903,15 @@ void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets ) void ScViewData::DeleteTab( SCTAB nTab ) { + assert(nTab < static_cast<SCTAB>(maTabData.size())); 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 ); } @@ -919,6 +925,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(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
