Skip to content

Commit 1a73528

Browse files
committed
ModAPI.Common: handle empty LauncherSettings.config
1 parent e070f4d commit 1a73528

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

ModAPI.Common/LauncherSettings.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,19 @@ public static bool Load(string path)
7777
using (var reader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)))
7878
{
7979
string xmlIn = reader.ReadToEnd();
80-
81-
var document = new XmlDocument();
82-
document.LoadXml(xmlIn);
83-
84-
foreach (XmlNode node in document.ChildNodes)
80+
if (!String.IsNullOrEmpty(xmlIn))
8581
{
86-
if (node.Name == "Settings")
82+
var document = new XmlDocument();
83+
document.LoadXml(xmlIn);
84+
85+
foreach (XmlNode node in document.ChildNodes)
8786
{
88-
foreach (XmlNode settingNode in node.ChildNodes)
87+
if (node.Name == "Settings")
8988
{
90-
_dictionary[settingNode.Name] = settingNode.InnerText;
89+
foreach (XmlNode settingNode in node.ChildNodes)
90+
{
91+
_dictionary[settingNode.Name] = settingNode.InnerText;
92+
}
9193
}
9294
}
9395
}

0 commit comments

Comments
 (0)