joystick: Don't crash when 0 joysticks exist on a port
* Interestingly, my SIXAXIS controller shows up in the window as usb/0 when plugged.
This commit is contained in:
parent
de81fde11c
commit
465610acdc
@ -501,6 +501,10 @@ JoyWin::_SelectDeselectJoystick(BListView* list, bool enable)
|
||||
PortItem *item;
|
||||
for (int i = 0; i < number; i++) {
|
||||
item = dynamic_cast<PortItem*>(list->ItemAt(i));
|
||||
if (!item) {
|
||||
printf("%s: PortItem at %d is null!\n", __func__, i);
|
||||
continue;
|
||||
}
|
||||
item->SetEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user