瀏覽代碼

Don't enforce PluginInfo to exist in order to load a plugin

ghorsington 5 年之前
父節點
當前提交
2004338ec9
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      BepInEx/Contract/BaseUnityPlugin.cs

+ 4 - 1
BepInEx/Contract/BaseUnityPlugin.cs

@@ -21,7 +21,10 @@ namespace BepInEx
 		{
 			var metadata = MetadataHelper.GetMetadata(this);
 
-			Info = Chainloader.PluginInfos[metadata.GUID];
+			if (Chainloader.PluginInfos.TryGetValue(metadata.GUID, out var info))
+				Info = info;
+			else
+				Logger.LogDebug($"Plugin [{metadata.GUID}] wasn't registered through chainloader! PluginInfo property will not be initialized.");
 
 			Logger = Logging.Logger.CreateLogSource(metadata.Name);