mirror of
https://github.com/vale981/VoiDPlugins
synced 2025-03-04 16:51:38 -05:00
Do not crash when VMulti device can't be found
This commit is contained in:
parent
11c8e31647
commit
7e1400c1af
1 changed files with 3 additions and 4 deletions
|
@ -8,7 +8,7 @@ namespace VoiDPlugins.Library.VMulti
|
|||
{
|
||||
public class VMultiInstance
|
||||
{
|
||||
private readonly HidStream _device;
|
||||
private readonly HidStream? _device;
|
||||
protected readonly byte[] Buffer;
|
||||
public unsafe VMultiReportHeader* Header { get; }
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace VoiDPlugins.Library.VMulti
|
|||
|
||||
public void Write()
|
||||
{
|
||||
_device.Write(Buffer);
|
||||
_device?.Write(Buffer);
|
||||
}
|
||||
|
||||
public unsafe void EnableButtonBit(int bit)
|
||||
|
@ -44,7 +44,7 @@ namespace VoiDPlugins.Library.VMulti
|
|||
return (buttons & bit) != 0;
|
||||
}
|
||||
|
||||
private static HidStream Retrieve(string Name)
|
||||
private static HidStream? Retrieve(string Name)
|
||||
{
|
||||
HidStream? VMultiDev = null;
|
||||
foreach (var device in DeviceList.Local.GetHidDevices(productID: 47820))
|
||||
|
@ -60,7 +60,6 @@ namespace VoiDPlugins.Library.VMulti
|
|||
{
|
||||
Log.Write(Name, "Cannot find VirtualHID", LogLevel.Error);
|
||||
Log.Write(Name, "Install VMulti driver here: https://github.com/X9VoiD/vmulti-bin/releases/latest", LogLevel.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return VMultiDev;
|
||||
|
|
Loading…
Add table
Reference in a new issue