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:
@@ -501,6 +501,10 @@ JoyWin::_SelectDeselectJoystick(BListView* list, bool enable)
|
|||||||
PortItem *item;
|
PortItem *item;
|
||||||
for (int i = 0; i < number; i++) {
|
for (int i = 0; i < number; i++) {
|
||||||
item = dynamic_cast<PortItem*>(list->ItemAt(i));
|
item = dynamic_cast<PortItem*>(list->ItemAt(i));
|
||||||
|
if (!item) {
|
||||||
|
printf("%s: PortItem at %d is null!\n", __func__, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
item->SetEnabled(enable);
|
item->SetEnabled(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user