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
+18 -18
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;
if (item->Submenu()) {
item = item->Submenu()->FindItem(label);
if (item)
break;
}
}
return item; return item;
if (item->Submenu() != NULL) {
item = item->Submenu()->FindItem(label);
if (item != NULL)
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;
if (item->Submenu()) {
item = item->Submenu()->FindItem(command);
if (item)
break;
}
}
return item; return item;
if (item->Submenu() != NULL) {
item = item->Submenu()->FindItem(command);
if (item != NULL)
return item;
}
}
return NULL;
} }