BOutlineListView::EachItemUnder gets too many items

EachItemUnder selects items that are not in fact under the superitem
passed to the method.

ticket: #13730
Change-Id: I12a2e29204e1b9bbecd5704e60a02e3613a7f4fd
Reviewed-on: https://review.haiku-os.org/52
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Sean Healy
2018-08-11 23:15:10 +00:00
committed by waddlesplash
parent 81375d4fbb
commit 2f3e1117f9
+3 -2
View File
@@ -721,15 +721,16 @@ BListItem*
BOutlineListView::EachItemUnder(BListItem* superItem, bool oneLevelOnly,
BListItem* (*eachFunc)(BListItem* item, void* arg), void* arg)
{
int32 i = IndexOf(superItem);
int32 i = FullListIndexOf(superItem);
if (i == -1)
return NULL;
i++; // skip the superitem
while (i < FullListCountItems()) {
BListItem* item = FullListItemAt(i);
// If we jump out of the subtree, return NULL
if (item->fLevel < superItem->OutlineLevel())
if (item->fLevel <= superItem->OutlineLevel())
return NULL;
// If the level matches, check the index