diff --git a/Tools/server_management/ScriptGenerator.cs b/Tools/server_management/ScriptGenerator.cs index 6a82a62..b6a1dec 100644 --- a/Tools/server_management/ScriptGenerator.cs +++ b/Tools/server_management/ScriptGenerator.cs @@ -51,14 +51,18 @@ namespace MCSJ.Tools.ServerManagement // 解析JRE配置 var jreVersions = new Dictionary>(); - string currentVersion = null; + string currentVersion = string.Empty; foreach (var line in File.ReadAllLines(jreConfigPath)) { if (line.StartsWith("[") && line.EndsWith("]")) { - currentVersion = line.Trim('[', ']'); - jreVersions[currentVersion] = new Dictionary(); + var version = line.Trim('[', ']'); + currentVersion = version ?? string.Empty; + if (currentVersion != null!) + { + jreVersions[currentVersion] = new Dictionary(); + } } else if (line.Contains("=") && currentVersion != null) {