[Libreoffice-commits] core.git: sd/source

Michael Stahl mstahl at redhat.com
Wed Jan 11 16:31:26 UTC 2017


 sd/source/ui/view/Outliner.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit aa1ee198b5b55d0a92418eb3294c93553e8513dd
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jan 11 17:17:27 2017 +0100

    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

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 959cfa4..396e0ef 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -583,7 +583,10 @@ void SdOutliner::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;


More information about the Libreoffice-commits mailing list