diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-07 16:03:34 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-07 17:13:54 +0200 |
commit | f5c27036ad63c8bc3d9b86f2e4e772c01490d883 (patch) | |
tree | 44d2f666603c978f753fb058bdb688d17984ab86 /sc | |
parent | 0e12a4055de19271e8756a323df684c0985c8e3a (diff) |
tdf#126748: temporary hack to avoid crash when several pivot tables ...
... reference a single cache, and have different sets of group fields.
The problem is getting group field names from the tables referencing
the cache; so when a table referencing not all group fields happens
to be first in the reference list, the returned name is empty.
The hack just stops writing group fields as soon as it finds an empty
name; this naturally leaves bad cache data behind, but at least doen't
crash. The retrieval of the names should be reimplemented using a
different source, to not depend on tables referencing the cache.
Regression after commit b082998401e37e6c7534906601bc481423a6ded0.
Change-Id: Ib2e92f8acf93a801861c6ba5c68fab3bebe3672c
Reviewed-on: https://gerrit.libreoffice.org/77110
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/xepivotxml.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 3143f3b1b04a..57abfd60b3b7 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -511,6 +511,16 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr for (size_t i = nCount; pDPObject && i < nCount + nGroupFieldCount; ++i) { const OUString aName = pDPObject->GetDimName(i, o3tl::temporary(bool())); + // tdf#126748: DPObject might not reference all group fields, when there are several + // DPObjects referencing this cache. Trying to get a dimension data for a field not used + // in a given DPObject will give nullptr, and dereferencing it then will crash. To avoid + // the crash, until there's a correct method to find the names of group fields in cache, + // just skip the fields, creating bad cache data, which is of course a temporary hack. + // TODO: reimplement the whole block to get the names from another source, not from first + // cache reference. + if (aName.isEmpty()) + break; + ScDPSaveData* pSaveData = pDPObject->GetSaveData(); assert(pSaveData); const ScDPSaveGroupDimension* pDim = pSaveData->GetDimensionData()->GetNamedGroupDim(aName); |