Skip to content

Commit

Permalink
Fix NPE if USB device descriptor cannot be fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed May 14, 2024
1 parent 5d05545 commit 8ce0610
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/org/cgutman/usbip/service/UsbIpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,9 @@ private UsbDeviceInfo getInfoForDevice(UsbDevice dev, UsbDeviceConnection devCon
// Since we're attached already, we can directly query the USB descriptors
// to fill some information that Android's USB API doesn't expose
devDesc = UsbControlHelper.readDeviceDescriptor(context.devConn);

ipDev.bcdDevice = devDesc.bcdDevice;
if (devDesc != null) {
ipDev.bcdDevice = devDesc.bcdDevice;
}
}

ipDev.speed = detectSpeed(dev, devDesc);
Expand Down

0 comments on commit 8ce0610

Please sign in to comment.