Skip to content

Commit

Permalink
Ensure keys in a better way
Browse files Browse the repository at this point in the history
  • Loading branch information
mnadareski committed Dec 3, 2024
1 parent c70b5f6 commit e788ad9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions BinaryObjectScanner/ProtectionDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void Append(string key, string? value)
if (value == null || value.Trim().Length == 0)
return;

EnsureKey(key);
foreach (string subValue in ProcessProtectionString(value))
{
this[key].Enqueue(subValue);
Expand All @@ -40,9 +41,6 @@ public void Append(string key, string? value)
/// <param name="values">String value array to add</param>
public void Append(string key, string[] values)
{
// Use a placeholder value if the key is null
key ??= "NO FILENAME";

// Add the key if needed and then append the lists
EnsureKey(key);
foreach (string value in values)
Expand Down Expand Up @@ -187,6 +185,7 @@ private void AddRangeToKey(string key, IEnumerable<string> values)
if (values == null)
return;

EnsureKey(key);
foreach (string value in values)
{
if (value == null || value.Trim().Length == 0)
Expand Down

0 comments on commit e788ad9

Please sign in to comment.