Selaa lähdekoodia

Fix default values in config not being escaped

ManlyMarco 4 vuotta sitten
vanhempi
commit
de6c2ccd4e

+ 1 - 1
BepInEx/Configuration/ConfigEntryBase.cs

@@ -158,7 +158,7 @@ namespace BepInEx.Configuration
 
 			writer.WriteLine("# Setting type: " + SettingType.Name);
 
-			writer.WriteLine("# Default value: " + DefaultValue);
+			writer.WriteLine("# Default value: " + TomlTypeConverter.ConvertToString(DefaultValue, SettingType));
 
 			if (Description.AcceptableValues != null)
 			{

+ 2 - 0
BepInEx/Configuration/TomlTypeConverter.cs

@@ -203,6 +203,8 @@ namespace BepInEx.Configuration
 
 		private static string Escape(this string txt)
 		{
+			if (string.IsNullOrEmpty(txt)) return string.Empty;
+
 			var stringBuilder = new StringBuilder(txt.Length + 2);
 			foreach (char c in txt)
 				switch (c)