summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-08-07 16:03:34 +0300
committerCaolán McNamara <caolanm@redhat.com>2019-08-09 17:30:29 +0200
commit5608074fa6cb1ebfbe8de5189bbe8d74606d088a (patch)
tree9d073fb5433494db149ab1ca4a6924cd6cfd3b69 /sc
parentf7642a8d6b97e501b8ac08e2c729c29aa8ab4d2e (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> (cherry picked from commit f5c27036ad63c8bc3d9b86f2e4e772c01490d883) Reviewed-on: https://gerrit.libreoffice.org/77124 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xepivotxml.cxx10
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);