Skip to content

Commit

Permalink
Fix the issue where certain remote desktop software may generate driv…
Browse files Browse the repository at this point in the history
…ers with unknown device types, causing null values in the values obtained by GetGPUNames, which leads to program crash during startup
  • Loading branch information
josStorer committed Jan 20, 2025
1 parent eb1b2a7 commit 3745b0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions QuickLook/NativeMethods/WMI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public static List<string> GetGPUNames()
List<string> names = [];

foreach (var obj in searcher.Get())
names.Add(obj["Name"] as string);
if (obj["Name"] is string name)
names.Add(name);

return names;
}
Expand All @@ -49,6 +50,7 @@ public static List<string> GetGPUNames()
{
Debug.WriteLine($"General exception caught: {e.Message}");
}

return [];
}
}
}

0 comments on commit 3745b0f

Please sign in to comment.