Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Commit 333fb21

Browse files
committed
fixed problem with HID devices without product names
1 parent 06e0aaf commit 333fb21

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/xbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ util.inherits(XboxController, events.EventEmitter);
260260
XboxController.prototype.loadController = function () {
261261

262262
HID.devices().forEach((function (d) {
263-
if (typeof d === 'object' && d.product.toLowerCase().indexOf(this.name.toLowerCase()) !== -1) {
263+
var product = (typeof d === 'object' && d.product) || '';
264+
if (product.toLowerCase().indexOf(this.name.toLowerCase()) !== -1) {
264265
this.hid = new HID.HID(d.path);
265266
console.log(chalk.green('notice: '), 'Xbox controller connected.');
266267
location = this.hid;

0 commit comments

Comments
 (0)