sc/source/core/data/dociter.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit 5fd2366296633e1b6c84e521e60985e62b8cbac1 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri May 19 12:17:13 2023 +0200 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Wed May 31 17:35:53 2023 +0200 sc: avoid crash in ScHorizontalCellIterator At least do not crash with release builds as seen in https://crashreport.libreoffice.org/stats/signature/ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument%20&,short,short,long,short,long) Change-Id: If253e950bbb709b585dc9398beddd1303dcb1b57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152000 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 5655cc201e5a80997fe21bc2a0c7abcbe4fb488f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152327 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Hossein <hoss...@libreoffice.org> Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 123d96d91b8c..fd4fa7afe42f 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1039,7 +1039,11 @@ ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument& rDocument, SCTAB { assert(mnTab < rDoc.GetTableCount() && "index out of bounds, FIX IT"); - nEndCol = rDoc.maTabs[mnTab]->ClampToAllocatedColumns(nEndCol); + const ScTable* pTab = rDoc.FetchTable(mnTab); + if (!pTab) + return; + + nEndCol = pTab->ClampToAllocatedColumns(nEndCol); if (nEndCol < nStartCol) // E.g., somewhere completely outside allocated area nEndCol = nStartCol - 1; // Empty