[Harness] Ensure we do not throw an exception if we do not have tasks. (#8272)

The First extension will throw an exception if the list is empty. Use
FirstOrDefault, check if the devices are null and return the test as
Ignored.

fixes: https://github.com/xamarin/xamarin-macios/issues/8271
This commit is contained in:
Manuel de la Pena 2020-04-03 13:23:35 -04:00 коммит произвёл GitHub
Родитель f8001a8114
Коммит 3004e7d34b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -63,7 +63,11 @@ namespace Xharness.Jenkins.TestTasks {
await task.SelectSimulatorAsync ();
}
var devices = executingTasks.First ().Simulators;
var devices = executingTasks.FirstOrDefault ()?.Simulators;
if (devices == null) {
ExecutionResult = TestExecutingResult.DeviceNotFound;
return;
}
Jenkins.MainLog.WriteLine ("Selected simulator: {0}", devices.Length > 0 ? devices [0].Name : "none");
foreach (var dev in devices)