[Libreoffice-bugs] [Bug 140014] Calc crashes when using COUNTIF, SUMIF, etc. on columns "far away" without data

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Jan 30 10:55:05 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=140014

--- Comment #4 from Julien Nabet <serval2412 at yahoo.fr> ---
I mimicked 
void ScQueryCellIterator::InitPos()
{
    nRow = maParam.nRow1;
    if (maParam.bHasHeader && maParam.bByRow)
        ++nRow;
    const ScColumn& rCol = rDoc.maTabs[nTab]->CreateColumnIfNotExists(nCol);
    maCurPos = rCol.maCells.position(nRow);
}

and this seems to work:
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 9597fcedbbfd..8f3f79461c53 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1469,8 +1469,8 @@ void ScCountIfCellIterator::InitPos()
     nRow = maParam.nRow1;
     if (maParam.bHasHeader && maParam.bByRow)
         ++nRow;
-    ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
-    maCurPos = pCol->maCells.position(nRow);
+    const ScColumn& rCol = rDoc.maTabs[nTab]->CreateColumnIfNotExists(nCol);
+    maCurPos = rCol.maCells.position(nRow);
 }

 void ScCountIfCellIterator::IncPos()


Any thoughts?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210130/15d6ec00/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list