Added try catch for Unix to DateTime to catch invalid inputs. Bumped package version to 1.1.9
This commit is contained in:
@ -29,8 +29,17 @@ namespace MontoyaTech.MySqlPlus
|
||||
if (unix == 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
try
|
||||
{
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unix).ToUniversalTime();
|
||||
}
|
||||
catch
|
||||
{
|
||||
//This isn't great, but if the input value is invalid, just return a min value instead
|
||||
//of crashing everything above us.
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("Unsupported input object to convert from unix.");
|
||||
|
@ -7,7 +7,7 @@
|
||||
<AssemblyName>MontoyaTech.MySqlPlus</AssemblyName>
|
||||
<RootNamespace>MontoyaTech.MySqlPlus</RootNamespace>
|
||||
<Title>MontoyaTech.MySqlPlus</Title>
|
||||
<Version>1.1.8</Version>
|
||||
<Version>1.1.9</Version>
|
||||
<Company>MontoyaTech</Company>
|
||||
<Description>A simple C# library to help work with MySql.</Description>
|
||||
<Copyright>MontoyaTech 2023</Copyright>
|
||||
|
Reference in New Issue
Block a user