Skip to content

Commit 845aa64

Browse files
committed
Add null-check to Section.Remove()
1 parent 8493ee1 commit 845aa64

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Src/Section.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,15 @@ public bool Remove(string settingName)
421421
/// </summary>
422422
/// <param name="setting">The setting to remove.</param>
423423
/// <returns>True if the setting was removed; false otherwise.</returns>
424-
public bool Remove(Setting setting) => _settings.Remove(setting);
424+
public bool Remove(Setting setting)
425+
{
426+
if (setting == null)
427+
{
428+
throw new ArgumentNullException(nameof(setting));
429+
}
430+
431+
return _settings.Remove(setting);
432+
}
425433

426434
/// <summary>
427435
/// Removes all settings that have a specific name.

0 commit comments

Comments
 (0)