summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-02-19 17:33:20 +0000
committerEike Rathke <erack@redhat.com>2023-02-23 19:29:11 +0000
commit0f305c976c4a619f53154d13be134d3bbe6f3302 (patch)
tree6b52eea0c4c9bfc7212250d5785dca48ec61953c /sc
parent34b50f81ac899d8430682e6087b27de38b3333e0 (diff)
crashtesting: crash on import of forum-mso-en4-702161.xlsx
vConditions is empty at this point for row 5 git show -w Change-Id: I05d984d73d4dd5a0ece894f854263528c9c00be9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147303 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 35e3c499cb64ed647fc8cc0a42a2d83948abcbdf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147287 Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr1.cxx34
1 files changed, 19 insertions, 15 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 405d9fe00023..5673bb7ecda2 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -6491,25 +6491,29 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf
if (nRefArrayMainPos < vRefArrayConditions.size())
vConditions = vRefArrayConditions[nRefArrayMainPos];
- std::vector<sal_uInt8>::const_iterator itRes = vConditions.begin();
- for (SCCOL nCol = 0; nCol < nDimensionCols; ++nCol)
+ SAL_WARN_IF(nDimensionCols && nDimensionRows && vConditions.empty(), "sc", "ScInterpreter::IterateParametersIfs vConditions is empty");
+ if (!vConditions.empty())
{
- for (SCROW nRow = 0; nRow < nDimensionRows; ++nRow, ++itRes)
+ std::vector<sal_uInt8>::const_iterator itRes = vConditions.begin();
+ for (SCCOL nCol = 0; nCol < nDimensionCols; ++nCol)
{
- if (*itRes == nQueryCount)
+ for (SCROW nRow = 0; nRow < nDimensionRows; ++nRow, ++itRes)
{
- aAdr.SetCol( nCol + nMainCol1);
- aAdr.SetRow( nRow + nMainRow1);
- ScRefCellValue aCell(mrDoc, aAdr);
- if (aCell.hasNumeric())
+ if (*itRes == nQueryCount)
{
- fVal = GetCellValue(aAdr, aCell);
- ++aRes.mfCount;
- aRes.mfSum += fVal;
- if ( aRes.mfMin > fVal )
- aRes.mfMin = fVal;
- if ( aRes.mfMax < fVal )
- aRes.mfMax = fVal;
+ aAdr.SetCol( nCol + nMainCol1);
+ aAdr.SetRow( nRow + nMainRow1);
+ ScRefCellValue aCell(mrDoc, aAdr);
+ if (aCell.hasNumeric())
+ {
+ fVal = GetCellValue(aAdr, aCell);
+ ++aRes.mfCount;
+ aRes.mfSum += fVal;
+ if ( aRes.mfMin > fVal )
+ aRes.mfMin = fVal;
+ if ( aRes.mfMax < fVal )
+ aRes.mfMax = fVal;
+ }
}
}
}