Skip to content

Commit

Permalink
Added null check for query string keys in SiteMapNode.cs.
Browse files Browse the repository at this point in the history
  • Loading branch information
akovsh authored and NightOwl888 committed Jul 25, 2014
1 parent 7099d4a commit fcedd7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -721,12 +721,13 @@ protected virtual IDictionary<string, object> MergeRouteValuesAndNamedQueryStrin
// Add any query string values from the current context
var queryStringValues = httpContext.Request.QueryString;

//QueryString collection might contain nullable keys
foreach (var key in queryStringValues.AllKeys)
{
// Copy the query string value as a route value if it doesn't already exist
// and the name is provided as a match. Note that route values will take
// precedence over query string parameters in cases of duplicates.
if (queryStringKeys.Contains(key) && !result.ContainsKey(key))
if (key != null && queryStringKeys.Contains(key) && !result.ContainsKey(key))
{
result[key] = queryStringValues[key];
}
Expand Down

0 comments on commit fcedd7b

Please sign in to comment.