diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-06-14 10:51:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-14 16:01:40 +0200 |
commit | 51ed616b278b257a490bc52b69d0bf9ed8de1e4b (patch) | |
tree | d17f4f1b0820bd35ccfc8e7571054297404a03a3 /sc | |
parent | 66b849eab05bb6b696cced84ca90c17ca1bc31dd (diff) |
crashtesting: crash seen on exporting forum-it-5909.ods to xlsx
Change-Id: I64b629e2f5b0ece7f903049bd006775463f97586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135818
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dptabres.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index c29648d95d8b..d41604eee45e 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -2767,7 +2767,10 @@ ScDPResultDimension::~ScDPResultDimension() ScDPResultMember *ScDPResultDimension::FindMember( SCROW iData ) const { if( bIsDataLayout ) - return maMemberArray[0].get(); + { + SAL_WARN_IF(maMemberArray.empty(), "sc.core", "MemberArray is empty"); + return !maMemberArray.empty() ? maMemberArray[0].get() : nullptr; + } MemberHash::const_iterator aRes = maMemberHash.find( iData ); if( aRes != maMemberHash.end()) { @@ -2974,8 +2977,11 @@ void ScDPResultDimension::LateInitFrom( tools::Long ScDPResultDimension::GetSize(tools::Long nMeasure) const { - tools::Long nTotal = 0; tools::Long nMemberCount = maMemberArray.size(); + if (!nMemberCount) + return 0; + + tools::Long nTotal = 0; if (bIsDataLayout) { OSL_ENSURE(nMeasure == SC_DPMEASURE_ALL || pResultData->GetMeasureCount() == 1, @@ -3128,7 +3134,7 @@ void ScDPResultDimension::SortMembers( ScDPResultMember* pRefMember ) // handle children // for data layout, call only once - sorting measure is always taken from settings - tools::Long nLoopCount = bIsDataLayout ? 1 : nCount; + tools::Long nLoopCount = bIsDataLayout ? std::min<tools::Long>(1, nCount) : nCount; for (tools::Long i=0; i<nLoopCount; i++) { ScDPResultMember* pMember = maMemberArray[i].get(); |