Bläddra i källkod

Fixed null sections acting weird

ManlyMarco 4 år sedan
förälder
incheckning
87edfafce0
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. 2 2
      BepInEx/Configuration/ConfigDefinition.cs
  2. 1 1
      BepInEx/Configuration/ConfigFile.cs

+ 2 - 2
BepInEx/Configuration/ConfigDefinition.cs

@@ -26,8 +26,8 @@ namespace BepInEx.Configuration
 		/// <param name="key">Name of the setting, case sensitive.</param>
 		public ConfigDefinition(string section, string key)
 		{
-			Key = key;
-			Section = section;
+			Key = key ?? throw new ArgumentNullException(nameof(key));
+			Section = section ?? throw new ArgumentNullException(nameof(section));
 		}
 
 		/// <summary>

+ 1 - 1
BepInEx/Configuration/ConfigFile.cs

@@ -255,7 +255,7 @@ namespace BepInEx.Configuration
 		/// </summary>
 		[Obsolete("Use other Wrap overloads instead")]
 		public ConfigWrapper<T> Wrap<T>(string section, string key, string description = null, T defaultValue = default(T))
-			=> Wrap(new ConfigDefinition(section, key), defaultValue, string.IsNullOrEmpty(description) ? null : new ConfigDescription(description));
+			=> Wrap(new ConfigDefinition(section ?? "", key), defaultValue, string.IsNullOrEmpty(description) ? null : new ConfigDescription(description));
 
 		/// <summary>
 		/// Create a new setting or access one of the existing ones. The setting is saved to drive and loaded automatically.