Both BMenu::FindItem() versions were broken and could return a wrong item.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14796 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-09 17:21:12 +00:00
parent c94c34e8cf
commit 8f4959d844
+10 -10
View File
@@ -462,16 +462,16 @@ BMenu::FindItem(const char *label) const
item = ItemAt(i); item = ItemAt(i);
if (item->Label() && strcmp(item->Label(), label) == 0) if (item->Label() && strcmp(item->Label(), label) == 0)
break; return item;
if (item->Submenu()) { if (item->Submenu() != NULL) {
item = item->Submenu()->FindItem(label); item = item->Submenu()->FindItem(label);
if (item) if (item != NULL)
break; return item;
} }
} }
return item; return NULL;
} }
@@ -484,16 +484,16 @@ BMenu::FindItem(uint32 command) const
item = ItemAt(i); item = ItemAt(i);
if (item->Command() == command) if (item->Command() == command)
break; return item;
if (item->Submenu()) { if (item->Submenu() != NULL) {
item = item->Submenu()->FindItem(command); item = item->Submenu()->FindItem(command);
if (item) if (item != NULL)
break; return item;
} }
} }
return item; return NULL;
} }