summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-05-19 12:17:13 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-05-31 08:56:07 +0200
commit5716bb7165e8b095c202ea7a8717f2633c0d006f (patch)
treeac77ae752027a6a3af04bd9db1c459550806c214 /sc
parent547bfbdbdaaa3b44f76952275bf87453f7c8293a (diff)
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 <erack@redhat.com> (cherry picked from commit 5655cc201e5a80997fe21bc2a0c7abcbe4fb488f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152325 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dociter.cxx6
1 files changed, 5 insertions, 1 deletions
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