sc/source/core/data/table2.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 8fc4e188586cf3c04592e0c1027a0c384bd3c54d
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Wed Feb 16 14:04:45 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Feb 16 16:02:15 2022 +0100

    non-const ScTable::GetFormulaCell() doesn't need to allocate columns
    
    A newly allocated column would contain no formula anyway.
    
    Change-Id: I7a9f65e5048c9fb6793caafdd4c60892659a1a57
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129998
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index cde674b07360..3ba705791336 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1803,9 +1803,10 @@ const ScFormulaCell* ScTable::GetFormulaCell( SCCOL 
nCol, SCROW nRow ) const
 
 ScFormulaCell* ScTable::GetFormulaCell( SCCOL nCol, SCROW nRow )
 {
-    if (!ValidColRow(nCol, nRow))
+    if (!ValidColRow(nCol, nRow) || nCol >= GetAllocatedColumnsCount())
         return nullptr;
-    return CreateColumnIfNotExists(nCol).GetFormulaCell(nRow);
+
+    return aCol[nCol].GetFormulaCell(nRow);
 }
 
 std::unique_ptr<ScPostIt> ScTable::ReleaseNote( SCCOL nCol, SCROW nRow )

Reply via email to