mirror of
https://github.com/Jackett/Jackett
synced 2025-02-28 08:55:39 +00:00
core: Convert Parse/Catch to TryParse (#11641)
This commit is contained in:
parent
db6a8d89a8
commit
47a4f0f422
1 changed files with 3 additions and 7 deletions
|
@ -176,16 +176,12 @@ namespace Jackett.Common.Utils
|
||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
// try parsing the str as an unix timestamp
|
||||||
|
if (long.TryParse(str, out var unixTimeStamp))
|
||||||
{
|
{
|
||||||
// try parsing the str as an unix timestamp
|
|
||||||
var unixTimeStamp = long.Parse(str);
|
|
||||||
return UnixTimestampToDateTime(unixTimeStamp);
|
return UnixTimestampToDateTime(unixTimeStamp);
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
// it wasn't a timestamp, continue....
|
||||||
{
|
|
||||||
// it wasn't a timestamp, continue....
|
|
||||||
}
|
|
||||||
|
|
||||||
// add missing year
|
// add missing year
|
||||||
match = _MissingYearRegexp.Match(str);
|
match = _MissingYearRegexp.Match(str);
|
||||||
|
|
Loading…
Reference in a new issue