fix null pointer
This commit is contained in:
parent
e6545a2455
commit
2bd3a4f503
|
@ -9,7 +9,7 @@
|
|||
<Identity
|
||||
Name="ac171214-3336-4e02-845d-9bdc107cce71"
|
||||
Publisher="CN=pcut, O=PCUT, L=HN, S=HN, C=VN"
|
||||
Version="1.3.1.0" />
|
||||
Version="1.3.2.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="ac171214-3336-4e02-845d-9bdc107cce71" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace PCUT.Pages
|
|||
if (infos != null && infos.Any())
|
||||
{
|
||||
var portInfos = new List<PortInfo>();
|
||||
foreach (var info in infos)
|
||||
foreach (var info in infos.Where(x => x.Id != null))
|
||||
{
|
||||
using (var deviceInfo = await SerialDevice.FromIdAsync(info.Id))
|
||||
{
|
||||
|
@ -181,12 +181,12 @@ namespace PCUT.Pages
|
|||
private async void Refresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var deviceInfo = await GetPortInfos();
|
||||
viewModel.Ports.Clear();
|
||||
foreach (var info in deviceInfo)
|
||||
viewModel.Ports.Add(info);
|
||||
if (deviceInfo.Any())
|
||||
viewModel.SelectedPortIndex = 0;
|
||||
}
|
||||
viewModel.Ports.Clear();
|
||||
foreach (var info in deviceInfo)
|
||||
viewModel.Ports.Add(info);
|
||||
if (deviceInfo.Any())
|
||||
viewModel.SelectedPortIndex = 0;
|
||||
}
|
||||
|
||||
private void TextBox_BeforeTextChanging(TextBox sender, TextBoxBeforeTextChangingEventArgs args)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue