Skip to content

Commit

Permalink
Fix CodeQL suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
commonsensesoftware committed Aug 24, 2022
1 parent ccf70c4 commit 00c5d3b
Showing 1 changed file with 3 additions and 10 deletions.
Expand Up @@ -44,16 +44,9 @@ public static void WriteSunsetPolicy( this HttpResponseMessage response, SunsetP

private static void AddLinkHeaders( HttpResponseHeaders headers, IList<LinkHeaderValue> links )
{
ICollection<string> values;

if ( headers.TryGetValues( Link, out var existing ) )
{
values = existing is ICollection<string> collection && !collection.IsReadOnly ? collection : new List<string>( existing );
}
else
{
values = new List<string>( capacity: links.Count );
}
var values = headers.TryGetValues( Link, out var existing )
? existing is ICollection<string> collection && !collection.IsReadOnly ? collection : new List<string>( existing )
: new List<string>( capacity: links.Count );

for ( var i = 0; i < links.Count; i++ )
{
Expand Down

0 comments on commit 00c5d3b

Please sign in to comment.