From aa99b57cdc8cb3763aa935ed84e7d80c4e56a172 Mon Sep 17 00:00:00 2001 From: Mark Hung Date: Mon, 19 Oct 2020 22:33:21 +0800 Subject: 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 --- sc/source/ui/view/spelleng.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index d9fdc3bb4e68..bb4c1f1ddf85 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) ) { -- cgit