Added try catch for Unix to DateTime to catch invalid inputs. Bumped package version to 1.1.9

This commit is contained in:
2025-06-27 13:09:27 -07:00
parent 34e9cce26b
commit 119ac93394
2 changed files with 11 additions and 2 deletions

View File

@ -29,7 +29,16 @@ namespace MontoyaTech.MySqlPlus
if (unix == 0)
return DateTime.MinValue;
return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unix).ToUniversalTime();
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
{

View File

@ -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>