diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-01-11 17:17:27 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-01-12 00:46:24 +0000 |
commit | 5f081ce502e5eeee528049fc76657d623afcee24 (patch) | |
tree | 3278302385fd6cf2efd30e0b286f4feb99aa62a2 | |
parent | bbb2a2bac5486b9a9b9d7061f058defc11fc447f (diff) |
tdf#105182 sd: avoid iterating too far in SdOutliner::Initialize()
Considering the valid indexes are extended by "-1" for backwards
iterators and "size()" for forward iterators, it's obvious that a
not-yet-at-the-end-in-the-other-direction iterator can be incremented
once, but not necessarily twice.
Why this code even wants to increment it twice isn't obvious to me.
Change-Id: I578c8c6202049ebe6dbed41b8276a6bfa0566bbc
(cherry picked from commit aa1ee198b5b55d0a92418eb3294c93553e8513dd)
Reviewed-on: https://gerrit.libreoffice.org/32975
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index f4d683910ba5..42d4a20cbda7 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -580,7 +580,10 @@ void Outliner::Initialize (bool bDirectionIsForward) // The iterator has pointed to the object one ahead/before the current // one. Now move it to the one before/ahead the current one. ++maObjectIterator; - ++maObjectIterator; + if (maObjectIterator != sd::outliner::OutlinerContainer(this).end()) + { + ++maObjectIterator; + } } mbMatchMayExist = true; |