Skip to content

Commit

Permalink
Avoid unneccessary throw of excption if timestamp is COMObject
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Jacobsen Work committed Nov 16, 2023
1 parent e049ce6 commit edd6da2
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions BLAZAMCommon/Helpers/CommonHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,21 +321,24 @@ public class ADsLargeInteger : IADsLargeInteger
{
if (value == null) return null;


Int64? longInt = null;
try
{
longInt = Int64.Parse(value.ToString());
}
catch (FormatException)
if (value.GetType().FullName != "System.__ComObject")
{
//Ignore input string format exception because it's probably
// a com object.

}
if (longInt != null)
{
dateTime = DateTime.FromFileTimeUtc(longInt.Value);
Int64? longInt = null;
try
{
longInt = Int64.Parse(value.ToString());
}
catch (FormatException)
{
//Ignore input string format exception because it's probably
// a com object.

}

if (longInt != null)
{
dateTime = DateTime.FromFileTimeUtc(longInt.Value);
}
}
else
{
Expand Down

0 comments on commit edd6da2

Please sign in to comment.