mirror of
https://github.com/libsdl-org/SDL
synced 2024-11-20 16:06:10 -07:00
Fixed Java exception if mConnection is null
This commit is contained in:
parent
588e32ea5a
commit
1ea4edddec
1 changed files with 10 additions and 0 deletions
|
@ -154,6 +154,11 @@ class HIDDeviceUSB implements HIDDevice {
|
|||
|
||||
@Override
|
||||
public int writeReport(byte[] report, boolean feature) {
|
||||
if (mConnection == null) {
|
||||
Log.w(TAG, "writeReport() called with no device connection");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (feature) {
|
||||
int res = -1;
|
||||
int offset = 0;
|
||||
|
@ -201,6 +206,11 @@ class HIDDeviceUSB implements HIDDevice {
|
|||
boolean skipped_report_id = false;
|
||||
byte report_number = report[0];
|
||||
|
||||
if (mConnection == null) {
|
||||
Log.w(TAG, "readReport() called with no device connection");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (report_number == 0x0) {
|
||||
/* Offset the return buffer by 1, so that the report ID
|
||||
will remain in byte 0. */
|
||||
|
|
Loading…
Reference in a new issue