diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2018-07-12 19:06:03 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-07-20 22:46:00 +0200 |
commit | 9ae56cdf78af1ff1b5c5178168b4aaa9a37c3e04 (patch) | |
tree | d9e58ccf6f2ebfed073f8371f98e088cfe178aff | |
parent | b981126108724be3ffb27b19a2142631288def1a (diff) |
tdf#118620 - avoid out of bounds iterator for end of sheet pivots.
Change-Id: I2ddcf56dc94175718739611f0791558fda87b1ba
Reviewed-on: https://gerrit.libreoffice.org/57358
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
(cherry picked from commit d3387b38fe0eea3fb7ac630c026f02986e8dafc4)
Reviewed-on: https://gerrit.libreoffice.org/57385
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 4a8ecfd9fdb6d8460bc7eee8773580d4ae550b18)
Reviewed-on: https://gerrit.libreoffice.org/57744
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/inc/columniterator.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/columniterator.cxx | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx index c6a87b4e6b39..799d437b33e0 100644 --- a/sc/inc/columniterator.hxx +++ b/sc/inc/columniterator.hxx @@ -60,6 +60,7 @@ class ColumnIterator { CellStoreType::const_position_type maPos; CellStoreType::const_position_type maPosEnd; + bool mbComplete; public: ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ); diff --git a/sc/source/core/data/columniterator.cxx b/sc/source/core/data/columniterator.cxx index f7367193d9cb..ad96639ca9d4 100644 --- a/sc/source/core/data/columniterator.cxx +++ b/sc/source/core/data/columniterator.cxx @@ -172,7 +172,8 @@ namespace sc { ColumnIterator::ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ) : maPos(rCells.position(nRow1)), - maPosEnd(rCells.position(maPos.first, nRow2+1)) + maPosEnd(rCells.position(maPos.first, nRow2)), + mbComplete(false) { } @@ -180,7 +181,10 @@ ColumnIterator::~ColumnIterator() {} void ColumnIterator::next() { - maPos = CellStoreType::next_position(maPos); + if ( maPos == maPosEnd) + mbComplete = true; + else + maPos = CellStoreType::next_position(maPos); } SCROW ColumnIterator::getRow() const @@ -190,7 +194,7 @@ SCROW ColumnIterator::getRow() const bool ColumnIterator::hasCell() const { - return maPos != maPosEnd; + return !mbComplete; } mdds::mtv::element_t ColumnIterator::getType() const |