Browse Source

Don't use an exception for control flow

ManlyMarco 5 years ago
parent
commit
7649fd0fee
1 changed files with 3 additions and 2 deletions
  1. 3 2
      BepInEx.Preloader/RuntimeFixes/TraceFix.cs

+ 3 - 2
BepInEx.Preloader/RuntimeFixes/TraceFix.cs

@@ -25,8 +25,9 @@ namespace BepInEx.Preloader.RuntimeFixes
 			TraceImplType = AppDomain.CurrentDomain.GetAssemblies()
 									 .First(x => x.GetName().Name == "System")
 									 .GetTypes()
-									 .First(x => x.Name == "TraceImpl");
-
+									 .FirstOrDefault(x => x.Name == "TraceImpl");
+			// assembly that has already fixed this
+			if (TraceImplType == null) return;
 
 			ListenersSyncRoot = AccessTools.Property(TraceImplType, "ListenersSyncRoot").GetValue(null, null);