Fix adb no devices detection

now throws when there are no devices connected
This commit is contained in:
Wroclaw 2022-07-20 01:01:18 +02:00
parent b7dbfcdd0c
commit 1ed0e6e7ec

View file

@ -220,11 +220,13 @@ function main {
# devices # devices
$devices = adb devices $devices = adb devices
if ($devices.Length -eq 2) {
throw "No devices found"
}
$devices = $devices[1..($devices.length-2)] $devices = $devices[1..($devices.length-2)]
[String]$selectedDevice = '' [String]$selectedDevice = ''
if ($devices.Length -eq 0) {throw "No devices found"} if ($devices.Length -eq 1) {
elseif ($devices.Length -eq 1) {
$selectedDevice = ($devices | ForEach-Object {$_.split()[0]})[0] $selectedDevice = ($devices | ForEach-Object {$_.split()[0]})[0]
} }
else { else {