Merge pull request #487 from mitchellcash/port_validation

Fixed: Proper port validation for download clients and connections
This commit is contained in:
Devin Buhl
2017-01-28 17:32:49 -05:00
committed by GitHub
14 changed files with 18 additions and 18 deletions

View File

@@ -76,14 +76,14 @@ namespace NzbDrone.Api.ClientSchema
if (propertyInfo.PropertyType == typeof(int))
{
var value = Convert.ToInt32(field.Value);
propertyInfo.SetValue(target, value, null);
var value = field.Value.ToString().ParseInt32();
propertyInfo.SetValue(target, value ?? 0, null);
}
else if (propertyInfo.PropertyType == typeof(long))
{
var value = Convert.ToInt64(field.Value);
propertyInfo.SetValue(target, value, null);
var value = field.Value.ToString().ParseInt64();
propertyInfo.SetValue(target, value ?? 0, null);
}
else if (propertyInfo.PropertyType == typeof(int?))