Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 2aa46b1

Browse files
committed
Fix possible NRE when disposing LeechCore in Vmm
Use null-conditional operator to safely dispose LeechCore, preventing a potential NullReferenceException if it is null (e.g., when Dispose is called from the constructor). Added a clarifying comment.
1 parent b3206c2 commit 2aa46b1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/VmmSharpEx/Vmm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private void Dispose(bool disposing)
195195
{
196196
if (disposing)
197197
{
198-
LeechCore.Dispose();
198+
LeechCore?.Dispose(); // Since this can be called from the ctor, Leechcore may be null here.
199199
RefreshManager.UnregisterAll(this);
200200
}
201201
Vmmi.VMMDLL_Close(_handle);

0 commit comments

Comments
 (0)