From fcedd7b3156e005df50bda22c31303dfefb83078 Mon Sep 17 00:00:00 2001 From: Alexey Kovsh Date: Tue, 15 Jul 2014 12:48:13 +0300 Subject: [PATCH] Added null check for query string keys in SiteMapNode.cs. --- src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs index a237471f..147648a7 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs @@ -721,12 +721,13 @@ protected virtual IDictionary 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]; }