summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/dbfunc3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/dbfunc3.cxx')
-rw-r--r--sc/source/ui/view/dbfunc3.cxx35
1 files changed, 16 insertions, 19 deletions
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 8baad38731e2..7ca42e09f0e2 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1697,29 +1697,26 @@ void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, long nDimIndex, bool bAscending
typedef std::unordered_map<OUString, sal_uInt16> UserSortMap;
UserSortMap aSubStrs;
sal_uInt16 nSubCount = 0;
- if (pUserListId)
+ ScUserList* pUserList = ScGlobal::GetUserList();
+ if (!pUserList)
+ return;
+
{
- ScUserList* pUserList = ScGlobal::GetUserList();
- if (!pUserList)
+ size_t n = pUserList->size();
+ if (!n || *pUserListId >= static_cast<sal_uInt16>(n))
return;
+ }
- {
- size_t n = pUserList->size();
- if (!n || *pUserListId >= static_cast<sal_uInt16>(n))
- return;
- }
-
- const ScUserListData& rData = (*pUserList)[*pUserListId];
- sal_uInt16 n = rData.GetSubCount();
- for (sal_uInt16 i = 0; i < n; ++i)
- {
- OUString aSub = rData.GetSubStr(i);
- if (!aMemberSet.count(aSub))
- // This string doesn't exist in the member name set. Don't add this.
- continue;
+ const ScUserListData& rData = (*pUserList)[*pUserListId];
+ sal_uInt16 n = rData.GetSubCount();
+ for (sal_uInt16 i = 0; i < n; ++i)
+ {
+ OUString aSub = rData.GetSubStr(i);
+ if (!aMemberSet.count(aSub))
+ // This string doesn't exist in the member name set. Don't add this.
+ continue;
- aSubStrs.emplace(aSub, nSubCount++);
- }
+ aSubStrs.emplace(aSub, nSubCount++);
}
// Rank all members.