#190 Tighten protections around `ModelStateDictionary` additions
This commit is contained in:
parent
fb3528f7f8
commit
e21688ffb5
|
|
@ -57,7 +57,14 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
_innerDictionary.TryGetValue(key, out value);
|
_innerDictionary.TryGetValue(key, out value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
set { _innerDictionary[key] = value; }
|
set
|
||||||
|
{
|
||||||
|
if(value == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("value");
|
||||||
|
}
|
||||||
|
_innerDictionary[key] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddModelError([NotNull] string key, [NotNull] Exception exception)
|
public void AddModelError([NotNull] string key, [NotNull] Exception exception)
|
||||||
|
|
@ -149,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||||
#region IDictionary members
|
#region IDictionary members
|
||||||
public void Add(KeyValuePair<string, ModelState> item)
|
public void Add(KeyValuePair<string, ModelState> item)
|
||||||
{
|
{
|
||||||
_innerDictionary.Add(item);
|
Add(item.Key, item.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add([NotNull] string key, [NotNull] ModelState value)
|
public void Add([NotNull] string key, [NotNull] ModelState value)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue