Skip to content

Commit

Permalink
Fix for updating non existing values
Browse files Browse the repository at this point in the history
  • Loading branch information
gavazquez committed Sep 22, 2018
1 parent 69f66c5 commit 5d2094a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions LunaConfigNode/MixedCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ public void Update(TK key, TV value)
{
lock (_lock)
{
if (SingleItems.ContainsKey(key))
if (!RepeatedItems.ContainsKey(key))
{
SingleItems[key].Value = value;
if (SingleItems.ContainsKey(key))
{
SingleItems[key].Value = value;
}
}
else
else if (RepeatedItems.ContainsKey(key))
{
throw new Exception($"Key value: \"{key}\" is not unique. Use Replace()");
}
Expand Down

0 comments on commit 5d2094a

Please sign in to comment.