From 92158788684c0d2d37e1124eb861539128e03e91 Mon Sep 17 00:00:00 2001 From: sigmabeta Date: Sat, 30 Jan 2016 10:24:44 -0500 Subject: [PATCH] Add some stability fixes, though probably not enough --- .../dolphinemu/utils/Java_GCAdapter.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java index 3e2c83bf66..87d816d93e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java @@ -76,13 +76,29 @@ public class Java_GCAdapter { } public static int Input() { - int read = usb_con.bulkTransfer(usb_in, controller_payload, controller_payload.length, 16); - return read; + if (usb_in != null) + { + int read = usb_con.bulkTransfer(usb_in, controller_payload, controller_payload.length, 16); + return read; + } + else + { + // TODO Is this right? + return 0; + } } public static int Output(byte[] rumble) { - int size = usb_con.bulkTransfer(usb_out, rumble, 5, 16); - return size; + if (usb_out != null) + { + int size = usb_con.bulkTransfer(usb_out, rumble, 5, 16); + return size; + } + else + { + // TODO Is this right? + return 0; + } } public static void OpenAdapter()