If a NULL menuitem was supplied to BMenu::_NextItem(), the function
would have returned the second item in place of the first. Also return NULL, not false, when there are no "next items". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24294 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8dd37e7af9
commit
5c30ed357a
@ -2354,10 +2354,13 @@ BMenu::_NextItem(BMenuItem *item, bool forward) const
|
||||
{
|
||||
// go to next item, and skip over disabled items such as separators
|
||||
int32 index = fItems.IndexOf(item);
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
|
||||
const int32 numItems = fItems.CountItems();
|
||||
if (index < 0) {
|
||||
if (forward)
|
||||
index = -1;
|
||||
else
|
||||
index = numItems;
|
||||
}
|
||||
int32 startIndex = index;
|
||||
do {
|
||||
if (forward)
|
||||
@ -2373,7 +2376,7 @@ BMenu::_NextItem(BMenuItem *item, bool forward) const
|
||||
} while (!ItemAt(index)->IsEnabled() && index != startIndex);
|
||||
|
||||
if (index == startIndex) // we are back where we started and no item was enabled
|
||||
return false;
|
||||
return NULL;
|
||||
|
||||
return ItemAt(index);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user