Kaydet (Commit) aa1ee198 authored tarafından Michael Stahl's avatar Michael Stahl

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
üst 4ff1b358
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment