Skip to content

Commit

Permalink
fix for getmodules null error
Browse files Browse the repository at this point in the history
  • Loading branch information
erfg12 committed Dec 28, 2021
1 parent 901799e commit 75cccc9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Memory/memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,22 @@ public void GetModules()
Debug.WriteLine("WARNING: Game is x86, but your Trainer is x64! You will be missing some modules, change your Trainer's Solution Platform.");
}

mProc.Modules.Clear();

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

if (mProc.Modules != null)
mProc.Modules.Clear();
else
mProc.Modules = new Dictionary<string, IntPtr>();

foreach (ProcessModule Module in mProc.Process.Modules)
{
if (Module.ModuleName == null || Module.BaseAddress == null)
continue;

if (!string.IsNullOrEmpty(Module.ModuleName) && !mProc.Modules.ContainsKey(Module.ModuleName))
mProc.Modules.Add(Module.ModuleName, Module.BaseAddress);
}
Expand Down

0 comments on commit 75cccc9

Please sign in to comment.