Skip to content

Commit af424c8

Browse files
committed
Exception handling #4150
1 parent efa8e81 commit af424c8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app/USB/AsusHid.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static class AsusHid
1919

2020
try
2121
{
22-
deviceList = DeviceList.Local.GetHidDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID) && device.GetMaxFeatureReportLength() > 0 && device.CanOpen);
22+
deviceList = DeviceList.Local.GetHidDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID) && device.CanOpen && device.GetMaxFeatureReportLength() > 0);
2323
}
2424
catch (Exception ex)
2525
{

app/USB/Aura.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,18 @@ public static byte[] AuraMessage(AuraMode mode, Color color, Color color2, int s
263263

264264
public static void Init()
265265
{
266-
AsusHid.Write(new List<byte[]> {
266+
try
267+
{
268+
AsusHid.Write(new List<byte[]> {
267269
new byte[] { AsusHid.AURA_ID, 0xB9 },
268270
Encoding.ASCII.GetBytes("]ASUS Tech.Inc."),
269271
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A },
270272
}, "Init");
273+
} catch (Exception ex)
274+
{
275+
Logger.WriteLine($"Error initializing Aura: {ex.Message}");
276+
return;
277+
}
271278

272279
if (AppConfig.IsZ13())
273280
AsusHid.Write([AsusHid.AURA_ID, 0xC0, 0x03, 0x01], "Dynamic Lighting Init");

0 commit comments

Comments
 (0)