Skip to content

Commit 8ce0610

Browse files
committed
Fix NPE if USB device descriptor cannot be fetched
1 parent 5d05545 commit 8ce0610

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/org/cgutman/usbip/service/UsbIpService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,9 @@ private UsbDeviceInfo getInfoForDevice(UsbDevice dev, UsbDeviceConnection devCon
364364
// Since we're attached already, we can directly query the USB descriptors
365365
// to fill some information that Android's USB API doesn't expose
366366
devDesc = UsbControlHelper.readDeviceDescriptor(context.devConn);
367-
368-
ipDev.bcdDevice = devDesc.bcdDevice;
367+
if (devDesc != null) {
368+
ipDev.bcdDevice = devDesc.bcdDevice;
369+
}
369370
}
370371

371372
ipDev.speed = detectSpeed(dev, devDesc);

0 commit comments

Comments
 (0)