summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2020-09-06 17:07:47 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-09-09 17:09:30 +0200
commit76139d1059f063a3f53e4bac8cc9790bf02629ad (patch)
tree48e69bc2467df9dd7644aa26cc32d4537d011fcf
parenttdf#95640 XLSX: import/export of custom sort lists (diff)
downloadcore-76139d1059f063a3f53e4bac8cc9790bf02629ad.tar.gz
core-76139d1059f063a3f53e4bac8cc9790bf02629ad.zip
Check range before accessing Calc sort userlist
Conflicts: sc/source/filter/excel/excrecds.cxx Change-Id: Ib5078dc4ce3f85be9b42320b60ef6fc40b684cb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102140 Tested-by: Jenkins Tested-by: Serge Krot <Serge.Krot@cib.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102255 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sc/source/core/data/table3.cxx4
-rw-r--r--sc/source/filter/excel/excrecds.cxx4
2 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 1ee6456d84a6..c27c73fb88e1 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1488,9 +1488,9 @@ short ScTable::CompareCell(
bool bNaturalSort = aSortParam.bNaturalSort; // natural sort
bool bCaseSens = aSortParam.bCaseSens; // case sensitivity
- if (bUserDef)
+ ScUserList* pList = ScGlobal::GetUserList();
+ if (bUserDef && pList && pList->size() > aSortParam.nUserIndex )
{
- ScUserList* pList = ScGlobal::GetUserList();
const ScUserListData& rData = (*pList)[aSortParam.nUserIndex];
if ( bNaturalSort )
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index d7ab5d7d95af..920955a6540d 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -935,7 +935,8 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
ScSortParam aSortParam;
pData->GetSortParam( aSortParam );
- if (aSortParam.bUserDef)
+ ScUserList* pList = ScGlobal::GetUserList();
+ if (aSortParam.bUserDef && pList && pList->size() > aSortParam.nUserIndex)
{
// get sorted area without headers
maSortRef = ScRange(
@@ -943,7 +944,6 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
aParam.nCol2, aParam.nRow2, aParam.nTab );
// get sorted columns with custom lists
- ScUserList* pList = ScGlobal::GetUserList();
const ScUserListData& rData = (*pList)[aSortParam.nUserIndex];
// get column index and sorting direction