Android: Add additional null check in GCAdapter
Just in case, since the documentation says this could be null.
This commit is contained in:
@@ -142,10 +142,16 @@ public class GCAdapter
|
|||||||
{
|
{
|
||||||
dev = adapterDevice;
|
dev = adapterDevice;
|
||||||
}
|
}
|
||||||
|
if (dev == null)
|
||||||
if (dev != null)
|
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
usbConnection = manager.openDevice(dev);
|
usbConnection = manager.openDevice(dev);
|
||||||
|
if (usbConnection == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Log.info("GCAdapter: Number of configurations: " + dev.getConfigurationCount());
|
Log.info("GCAdapter: Number of configurations: " + dev.getConfigurationCount());
|
||||||
Log.info("GCAdapter: Number of interfaces: " + dev.getInterfaceCount());
|
Log.info("GCAdapter: Number of interfaces: " + dev.getInterfaceCount());
|
||||||
@@ -178,7 +184,6 @@ public class GCAdapter
|
|||||||
Toast.makeText(DolphinApplication.getAppContext(), R.string.replug_gc_adapter,
|
Toast.makeText(DolphinApplication.getAppContext(), R.string.replug_gc_adapter,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
usbConnection.close();
|
usbConnection.close();
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user