Skip to content

Commit

Permalink
added some null checks in GetModules
Browse files Browse the repository at this point in the history
  • Loading branch information
erfg12 committed Dec 22, 2021
1 parent 1220219 commit 901799e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Memory/memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ public bool IsAdmin()
public void GetModules()
{
if (mProc.Process == null)
{
Debug.WriteLine("mProc.Process is null so GetModules failed.");
return;
}

if (mProc.Is64Bit && IntPtr.Size != 8)
{
Expand All @@ -203,6 +206,12 @@ public void GetModules()

mProc.Modules.Clear();

if (mProc.Process.Modules == null)
{
Debug.WriteLine("mProc.Process.Modules is null so GetModules failed.");
return;
}

foreach (ProcessModule Module in mProc.Process.Modules)
{
if (!string.IsNullOrEmpty(Module.ModuleName) && !mProc.Modules.ContainsKey(Module.ModuleName))
Expand Down

0 comments on commit 901799e

Please sign in to comment.