Check if devices list is empty before trying to access to ensure Index was out of range exception doesn't occur.

This commit is contained in:
Chax
2024-02-29 00:43:01 +01:00
parent 0b8ca66692
commit ea8e16c418

View File

@@ -829,7 +829,7 @@ namespace AndroidSideloader
}
});
}
else if (Devices[0].Length > 1)
else if (Devices.Count > 0 && Devices[0].Length > 1) // Check if Devices list is not empty and the first device has a valid length
{
this.Invoke(() => { Text = "Device Connected with ID | " + Devices[0].Replace("device", String.Empty); });
DeviceConnected = true;