Fix Radios crash

This commit is contained in:
Théo Marchal 2022-04-12 23:14:13 +02:00
parent 4136c13d5b
commit f95b884d16

View File

@ -78,16 +78,24 @@ namespace unison
public async void Initialize() public async void Initialize()
{ {
List<NameAndCount> Countries = await _radioBrowser.Lists.GetCountriesAsync(); try
CountryList.Items.Add(new CountryListItem { Name = "", Count = 0 });
foreach (NameAndCount Country in Countries)
{ {
CountryList.Items.Add(new CountryListItem List<NameAndCount> Countries = await _radioBrowser.Lists.GetCountriesAsync();
CountryList.Items.Add(new CountryListItem { Name = "", Count = 0 });
foreach (NameAndCount Country in Countries)
{ {
Name = Country.Name, CountryList.Items.Add(new CountryListItem
Count = Country.Stationcount {
}); Name = Country.Name,
Count = Country.Stationcount
});
}
}
catch (Exception e)
{
Debug.WriteLine("Exception while getting countries in RadioBrowser: " + e.Message);
return;
} }
} }