mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +00:00
Potential fix for reading null IPIDs from configs
This commit is contained in:
@@ -452,8 +452,17 @@ namespace ICD.Common.Utils
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static byte FromIpIdString(string value)
|
public static byte FromIpIdString(string value)
|
||||||
{
|
{
|
||||||
value = value.Replace("0x", "");
|
if (value == null)
|
||||||
return Convert.ToByte(value, 16);
|
throw new ArgumentNullException("value");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (byte)Convert.ToInt64(value, 16);
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException e)
|
||||||
|
{
|
||||||
|
throw new FormatException(e.Message, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ namespace ICD.Common.Utils.Xml
|
|||||||
throw new ArgumentNullException("extends");
|
throw new ArgumentNullException("extends");
|
||||||
|
|
||||||
string content = extends.ReadElementContentAsString();
|
string content = extends.ReadElementContentAsString();
|
||||||
return (byte)Convert.ToInt64(content, 16);
|
return StringUtils.FromIpIdString(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user