瀏覽代碼

Don't use an exception for control flow

ManlyMarco 5 年之前
父節點
當前提交
7649fd0fee
共有 1 個文件被更改,包括 3 次插入2 次删除
  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);