Pārlūkot izejas kodu

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

ghorsington 5 gadi atpakaļ
vecāks
revīzija
2004338ec9
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  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);