Skip to content

Commit 6267899

Browse files
xnaughtPhyxionNL
andauthored
Fix null reference in MemoryGroup when Ring0 is disabled. (#1796)
* Create RAMSPDToolkitDriver with null when Ring0 is absent * Update MemoryGroup.cs --------- Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
1 parent 3b1c1cb commit 6267899

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

LibreHardwareMonitorLib/Hardware/Memory/MemoryGroup.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ static MemoryGroup()
3333
{
3434
if (Ring0.IsOpen)
3535
{
36-
//Assign implementation of IDriver
36+
// Assign implementation of IDriver.
3737
DriverManager.Driver = new RAMSPDToolkitDriver(Ring0.KernelDriver);
3838
SMBusManager.UseWMI = false;
3939
}
40+
else
41+
{
42+
// Still need to set Driver if Ring0 is absent.
43+
DriverManager.Driver = new RAMSPDToolkitDriver(null);
44+
SMBusManager.UseWMI = false;
45+
}
4046
}
4147

4248
public MemoryGroup(ISettings settings)

0 commit comments

Comments
 (0)