Skip to content

Commit e070f4d

Browse files
committed
ModAPI.Common: handle empty InstalledMods.config
1 parent 7b555d1 commit e070f4d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ModAPI.Common/InstalledMods.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,17 @@ public bool Load(string path)
251251
using (var reader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)))
252252
{
253253
string xmlIn = reader.ReadToEnd();
254-
255-
var document = new XmlDocument();
256-
document.LoadXml(xmlIn);
257-
258-
foreach (XmlNode node in document.ChildNodes)
254+
if (!String.IsNullOrEmpty(xmlIn))
259255
{
260-
if (node.Name == InstalledMods.ElementName)
256+
var document = new XmlDocument();
257+
document.LoadXml(xmlIn);
258+
259+
foreach (XmlNode node in document.ChildNodes)
261260
{
262-
Load(document, node);
261+
if (node.Name == InstalledMods.ElementName)
262+
{
263+
Load(document, node);
264+
}
263265
}
264266
}
265267
}

0 commit comments

Comments
 (0)