Skip to content

Commit

Permalink
fixing a potential bug with section line number detection
Browse files Browse the repository at this point in the history
  • Loading branch information
salaros committed Aug 13, 2018
1 parent bcdb307 commit 32713c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ public bool SetValue(string sectionName, string keyName, string value)

if (!sections.TryGetValue(sectionName, out var section))
{
section = new ConfigSection(sectionName, Lines.Max(l => l.LineNumber));
var lineNumber = (null != Lines && Lines.Any()) ? Lines.Max(l => l.LineNumber) : -1;
section = new ConfigSection(sectionName, lineNumber);
sections.Add(sectionName, section);
}

Expand Down

0 comments on commit 32713c4

Please sign in to comment.