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:
Alexander von Gluck IV 2014-01-05 23:35:05 -06:00
parent de81fde11c
commit 465610acdc
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}
}