diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-06-14 10:51:13 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-06-24 13:42:25 +0200 |
commit | f780cc69fcb8d16bf683b1e025ae60f581d41bce (patch) | |
tree | dd7204fe6e31db976fb687a9596c455627d77b85 /sc/source | |
parent | 74265905b7b1b4ef52fca27511dd781a2c45ba05 (diff) |
crashtesting: crash seen on exporting forum-it-5909.ods to xlsx
Change-Id: I64b629e2f5b0ece7f903049bd006775463f97586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135752
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/source')
-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 e49fbd365b44..f17e1b51eb44 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(); |