Skip to content

Commit 3520f0d

Browse files
committed
Use .TryGetValue() when we expect the key might not exist.
1 parent f1f8e1a commit 3520f0d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Json/SimpleJsonConfigBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ private Dictionary<string, string> GetCurrentDictionary()
142142
{
143143
if (JsonMode == SimpleJsonConfigBuilderMode.Sectional && _currentSection != null)
144144
{
145-
Dictionary<string, string> d = _allSettings[_currentSection];
146-
return d ?? _allSettings[""];
145+
if (_allSettings.TryGetValue(_currentSection, out Dictionary<string, string> d))
146+
return d;
147147
}
148148

149149
return _allSettings[""];

0 commit comments

Comments
 (0)