diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LMSensors.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LMSensors.cs index 5226924..3f80134 100644 --- a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LMSensors.cs +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LMSensors.cs @@ -16,17 +16,21 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc; internal class LMSensors { - private readonly List _superIOs = new(); + private const string HwMonPath = "/sys/class/hwmon/"; + private readonly List _superIOs = []; public LMSensors() { - foreach (string basePath in Directory.GetDirectories("/sys/class/hwmon/")) + if (!Directory.Exists(HwMonPath)) + return; + + foreach (string basePath in Directory.GetDirectories(HwMonPath)) { foreach (string devicePath in new[] { "/device", string.Empty }) { string path = basePath + devicePath; - string name = null; + try { using StreamReader reader = new(path + "/name"); diff --git a/LibreHardwareMonitorLib/Hardware/SMBios.cs b/LibreHardwareMonitorLib/Hardware/SMBios.cs index 71a7a0a..0fe5d64 100644 --- a/LibreHardwareMonitorLib/Hardware/SMBios.cs +++ b/LibreHardwareMonitorLib/Hardware/SMBios.cs @@ -1324,11 +1324,11 @@ public class SMBios return reader.ReadLine(); } - return null; + return string.Empty; } catch { - return null; + return string.Empty; } }