Browse Source

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

ghorsington 5 years ago
parent
commit
2004338ec9
1 changed files with 4 additions and 1 deletions
  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);