summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-08-07 16:03:34 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-08-08 10:59:38 +0200
commitfd09ed3d7424a1cb579758769efe465d272ae77d (patch)
tree41f2baf5b5e954c6ca5caf5577b795f0b19ebde6
parenta8c06f3e6498da3e16bdcbf6f7d505a2019a8514 (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> Reviewed-on: https://gerrit.libreoffice.org/77129 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-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 752d971cfd25..fe6281cb050f 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -535,6 +535,16 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
{
bool bDummy = false;
const OUString aName = pDPObject->GetDimName(i, bDummy);
+ // 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);