Trying to track down NullPointerException in USB input thread
authorSam Lantinga <slouken@libsdl.org>
Mon, 08 Oct 2018 12:49:26 -0700
changeset 12306094a25b0d812
parent 12305 85c6aa0836d8
child 12307 461ef7221483
Trying to track down NullPointerException in USB input thread
android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java	Mon Oct 08 12:49:25 2018 -0700
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java	Mon Oct 08 12:49:26 2018 -0700
     1.3 @@ -276,7 +276,16 @@
     1.4              int packetSize = mInputEndpoint.getMaxPacketSize();
     1.5              byte[] packet = new byte[packetSize];
     1.6              while (mRunning) {
     1.7 -                int r = mConnection.bulkTransfer(mInputEndpoint, packet, packetSize, 1000);
     1.8 +                int r;
     1.9 +                try
    1.10 +                {
    1.11 +                    r = mConnection.bulkTransfer(mInputEndpoint, packet, packetSize, 1000);
    1.12 +                }
    1.13 +                catch (Exception e)
    1.14 +                {
    1.15 +                    Log.v(TAG, "Exception in UsbDeviceConnection bulktransfer: " + e);
    1.16 +                    break;
    1.17 +                }
    1.18                  if (r < 0) {
    1.19                      // Could be a timeout or an I/O error
    1.20                  }