mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 12:03:02 +00:00
Fix a user-reported crash in USB code
This commit is contained in:
parent
e7e73aa1d2
commit
46c5eaf0e1
@ -12,6 +12,8 @@ import android.hardware.usb.UsbManager;
|
|||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
|
import com.limelight.LimeLog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class UsbDriverService extends Service implements UsbDriverListener {
|
public class UsbDriverService extends Service implements UsbDriverListener {
|
||||||
@ -110,6 +112,10 @@ public class UsbDriverService extends Service implements UsbDriverListener {
|
|||||||
|
|
||||||
// Open the device
|
// Open the device
|
||||||
UsbDeviceConnection connection = usbManager.openDevice(device);
|
UsbDeviceConnection connection = usbManager.openDevice(device);
|
||||||
|
if (connection == null) {
|
||||||
|
LimeLog.warning("Unable to open USB device: "+device.getDeviceName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Try to initialize it
|
// Try to initialize it
|
||||||
XboxOneController controller = new XboxOneController(device, connection, nextDeviceId++, this);
|
XboxOneController controller = new XboxOneController(device, connection, nextDeviceId++, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user