Trying to track down NullPointerException in USB input thread

This commit is contained in:
Sam Lantinga 2018-10-08 12:49:26 -07:00
parent 4d771c598a
commit e4c9806f4f

View File

@ -276,7 +276,16 @@ class HIDDeviceUSB implements HIDDevice {
int packetSize = mInputEndpoint.getMaxPacketSize();
byte[] packet = new byte[packetSize];
while (mRunning) {
int r = mConnection.bulkTransfer(mInputEndpoint, packet, packetSize, 1000);
int r;
try
{
r = mConnection.bulkTransfer(mInputEndpoint, packet, packetSize, 1000);
}
catch (Exception e)
{
Log.v(TAG, "Exception in UsbDeviceConnection bulktransfer: " + e);
break;
}
if (r < 0) {
// Could be a timeout or an I/O error
}