summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2020-10-19 22:33:21 +0800
committerCaolán McNamara <caolanm@redhat.com>2020-10-20 16:40:32 +0200
commita9bad3ef281c825bf57437a1b5154e413d7f18cd (patch)
tree27034ee8c5eec87aff6875b6262dd2d02caaad3e /sc
parent52421298155eeea4f907a0a1f52e5725e9c8caf0 (diff)
tdf#137594 prevent converting unallocated columns.
Check col against GetAllocatedColumnsCount() instead of MaxCol(). This prevents allocating a new column just for converting an empty cell. Change-Id: I5c8dcfffc2661ab9c4fd9c2c53ed389e57351517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104528 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit aa99b57cdc8cb3763aa935ed84e7d80c4e56a172) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104503 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/spelleng.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 5035cd31a858..2b754ce08ddf 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -153,7 +153,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
bLoop = false;
mbFinished = true;
}
- else if( nNewCol > mrDoc.MaxCol() )
+ else if( nNewCol >= mrDoc.GetAllocatedColumnsCount(mnStartTab) )
{
// no more cells in the sheet - try to restart at top of sheet
@@ -178,6 +178,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
}
else
{
+ // GetPattern may implicitly allocates the column if not exists,
pPattern = mrDoc.GetPattern( nNewCol, nNewRow, mnStartTab );
if( pPattern && (pPattern != pLastPattern) )
{