Potential fix for reading null IPIDs from configs

This commit is contained in:
Chris Cameron
2017-11-20 17:18:31 -05:00
parent ec0f3ebc97
commit 55d2f437cc
2 changed files with 12 additions and 3 deletions

View File

@@ -452,8 +452,17 @@ namespace ICD.Common.Utils
/// <returns></returns>
public static byte FromIpIdString(string value)
{
value = value.Replace("0x", "");
return Convert.ToByte(value, 16);
if (value == null)
throw new ArgumentNullException("value");
try
{
return (byte)Convert.ToInt64(value, 16);
}
catch (ArgumentOutOfRangeException e)
{
throw new FormatException(e.Message, e);
}
}
/// <summary>

View File

@@ -246,7 +246,7 @@ namespace ICD.Common.Utils.Xml
throw new ArgumentNullException("extends");
string content = extends.ReadElementContentAsString();
return (byte)Convert.ToInt64(content, 16);
return StringUtils.FromIpIdString(content);
}
/// <summary>