summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-28 21:22:56 +0100
committerAndras Timar <andras.timar@collabora.com>2018-06-27 12:37:23 +0200
commit3547cd460263f710d2f49fbb8bf00808c012629e (patch)
treed0af123efbeb4866a35936e907ffbaf8d5a23f63 /sc
parent5e3365e88c94450e6db687eb46425e07db6997f5 (diff)
forcepoint#40 null deref
presumably since commit 0098bee792c3e208ea4f6ef1c676958d3f4cd207 Date: Thu Sep 21 06:48:09 2017 +0200 tdf#112501: Pivot table: popupbuttons are placed on wrong cells Change-Id: I5413c0ba06fca25cb22256a20ef9640767dd9e50 Reviewed-on: https://gerrit.libreoffice.org/54970 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> (cherry picked from commit 69c5be9b26cf1a45e220d69f65b1bb0fa2aedaf6) (cherry picked from commit 47f090e2e4ba84684cdd1c0684cb1b9f2baa600f)
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xls/forcepoint-pivot-1.xlsbin0 -> 28160 bytes
-rw-r--r--sc/source/filter/excel/xipivot.cxx8
2 files changed, 4 insertions, 4 deletions
diff --git a/sc/qa/unit/data/xls/forcepoint-pivot-1.xls b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls
new file mode 100644
index 000000000000..12919922666b
--- /dev/null
+++ b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls
Binary files differ
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index abeeba02afdf..b8fd741a6cfe 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1569,13 +1569,13 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD
itr = aFieldBtns.begin();
itrEnd = aFieldBtns.end();
vector<const ScDPSaveDimension*>::const_iterator itDim = aFieldDims.begin();
- for (; itr != itrEnd; ++itr, ++itDim)
+ for (; itr != itrEnd; ++itr)
{
ScMF nMFlag = ScMF::Button;
- const ScDPSaveDimension* pDim = *itDim;
- if (pDim->HasInvisibleMember())
+ const ScDPSaveDimension* pDim = itDim != aFieldDims.end() ? *itDim++ : nullptr;
+ if (pDim && pDim->HasInvisibleMember())
nMFlag |= ScMF::HiddenMember;
- if (!pDim->IsDataLayout())
+ if (!pDim || !pDim->IsDataLayout())
nMFlag |= ScMF::ButtonPopup;
rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag);
}