Update BLayout::IndexOfView() to return NULL for NULL input, and check for BViews that where added by BLayout, instead of by BViewLayoutItem.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39043 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -251,10 +251,14 @@ BLayout::IndexOfItem(const BLayoutItem* item) const
|
||||
int32
|
||||
BLayout::IndexOfView(BView* child) const
|
||||
{
|
||||
if (child == NULL)
|
||||
return -1;
|
||||
|
||||
int itemCount = fItems.CountItems();
|
||||
for (int32 i = 0; i < itemCount; i++) {
|
||||
BLayoutItem* item = (BLayoutItem*)fItems.ItemAt(i);
|
||||
if (dynamic_cast<BViewLayoutItem*>(item) && item->View() == child)
|
||||
if (item->View() == child && (dynamic_cast<BViewLayoutItem*>(item)
|
||||
|| dynamic_cast<BLayout*>(item)))
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user