Input preferences: fix list item retrieval

Fixes #16679

Change-Id: I87844b7745dc2d9e126983a888caf01f37f6b742
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3540
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Máximo Castañeda 2020-12-20 21:54:13 +01:00 committed by Adrien Destugues
parent 6011ce6c74
commit a0f0cb5a9d

View File

@ -113,11 +113,11 @@ InputWindow::MessageReceived(BMessage* message)
if (device)
AddDevice(device);
} else {
for (int i = 0; i < fDeviceListView->CountItems();
i++) {
BStringItem* item = dynamic_cast<BStringItem*>(
fDeviceListView->ItemAt(i));
if (item->Text() == name) {
for (int i = 0; i < fDeviceListView->CountItems(); i++) {
DeviceListItemView* item =
dynamic_cast<DeviceListItemView*>(
fDeviceListView->ItemAt(i));
if (item != NULL && item->Label() == name) {
fDeviceListView->RemoveItem(i);
BView* settings = fCardView->ChildAt(i);
fCardView->RemoveChild(settings);