Skip to content

Commit

Permalink
Fixed possible crash on system startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatUsernameAlreadyExist committed Feb 15, 2025
1 parent d42b3c7 commit 39a8ba1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
40 changes: 26 additions & 14 deletions src/BLEMouseWatcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,33 @@ static void Main(string[] args)
}
}
}
}


static BluetoothLEDevice findMonitoredBluetoothLEDevice()
}

static BluetoothLEDevice findMonitoredBluetoothLEDevice()
{
Task<DeviceInformationCollection> task = DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector()).AsTask();
foreach (DeviceInformation device in task.Result)
{
if (monitoredDevices.Contains(device.Name))
try
{
Task<DeviceInformationCollection> task = DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector()).AsTask();
foreach (DeviceInformation device in task.Result)
{
Task<BluetoothLEDevice> bleDevice = BluetoothLEDevice.FromIdAsync(device.Id).AsTask();
return bleDevice.Result;
}
}
return null;
}
if (monitoredDevices.Contains(device.Name))
{
Task<BluetoothLEDevice> bleDevice = BluetoothLEDevice.FromIdAsync(device.Id).AsTask();
try
{
return bleDevice.Result;
}
catch (Exception)
{
}
}
}
}
catch (Exception)
{
}

return null;
}
}
}
4 changes: 2 additions & 2 deletions src/BLEMouseWatcher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyVersion("3.0.2.0")]
[assembly: AssemblyFileVersion("3.0.2.0")]

0 comments on commit 39a8ba1

Please sign in to comment.