feat: connect to first device if given device was not found

This commit is contained in:
oSumAtrIX 2023-01-15 05:17:38 +01:00
parent 4edc325978
commit 6485e477a1
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -17,7 +17,7 @@ internal class Adb(
private val device: JadbDevice
init {
device = JadbConnection().devices.find { it.serial == deviceName }
device = JadbConnection().devices.let { device -> device.find { it.serial == deviceName } ?: device.first() }
?: throw IllegalArgumentException("No such device with name $deviceName")
if (!modeInstall && device.run("su -h", false) != 0)