diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-05-19 12:17:13 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-06-04 16:34:08 +0200 |
commit | 7b56b8fc8345e04c782df7769be0d18f1f810337 (patch) | |
tree | 2e16bd347da3173ec56997d6b4dd03b3a724785c /sc | |
parent | 19926177aae92c6e69aa00bd078f8a59999f3042 (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.cxx | 6 |
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 |