Skip to content
This repository was archived by the owner on Jun 27, 2024. It is now read-only.

Commit 909e859

Browse files
committed
Bug fixes
1 parent b4b7881 commit 909e859

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/Jobs/OpenModAssemblyLoadJob.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@ public void ExecuteMigration()
2020
try
2121
{
2222
var assemblyLoadEvent = (MulticastDelegate)typeof(AppDomain)
23-
.GetField("AssemblyLoad", BindingFlags.NonPublic | BindingFlags.Instance)
23+
.GetField("AssemblyLoad", BindingFlags.NonPublic | BindingFlags.Instance)!
2424
.GetValue(AppDomain.CurrentDomain);
2525

26-
foreach (var @delegate in assemblyLoadEvent.GetInvocationList())
26+
if (assemblyLoadEvent != null)
2727
{
28-
var asmFullName = @delegate?.GetMethodInfo()?.DeclaringType?.Assembly?.FullName;
29-
if (asmFullName != null && (asmFullName.StartsWith("AviRockets.Module", StringComparison.OrdinalIgnoreCase)
30-
|| asmFullName.StartsWith("AviRockets.Mothership", StringComparison.OrdinalIgnoreCase)))
28+
foreach (var @delegate in assemblyLoadEvent.GetInvocationList())
3129
{
32-
var eventHandler = (AssemblyLoadEventHandler)@delegate;
33-
AppDomain.CurrentDomain.AssemblyLoad -= eventHandler;
34-
aviEvents.Add(eventHandler);
30+
var asmFullName = @delegate?.GetMethodInfo()?.DeclaringType?.Assembly?.FullName;
31+
if (asmFullName != null && (asmFullName.StartsWith("AviRockets.Module", StringComparison.OrdinalIgnoreCase)
32+
|| asmFullName.StartsWith("AviRockets.Mothership", StringComparison.OrdinalIgnoreCase)))
33+
{
34+
var eventHandler = (AssemblyLoadEventHandler)@delegate;
35+
AppDomain.CurrentDomain.AssemblyLoad -= eventHandler;
36+
aviEvents.Add(eventHandler);
37+
}
3538
}
3639
}
3740

src/OpenModManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public OpenModManager()
2121
foreach (var moduleDirectory in Directory.GetDirectories(modulesDirectory))
2222
{
2323
var isModuleFilePresent = Directory
24-
.GetFiles(moduleDirectory, "*.module,", SearchOption.TopDirectoryOnly)
24+
.GetFiles(moduleDirectory, "*.module", SearchOption.TopDirectoryOnly)
2525
.Length > 0;
2626

2727
// Not an Unturned module

0 commit comments

Comments
 (0)