mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
core: Convert Parse/Catch to TryParse (#11641)
This commit is contained in:
@@ -176,16 +176,12 @@ namespace Jackett.Common.Utils
|
|||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// try parsing the str as an unix timestamp
|
// try parsing the str as an unix timestamp
|
||||||
var unixTimeStamp = long.Parse(str);
|
if (long.TryParse(str, out var unixTimeStamp))
|
||||||
|
{
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user