[frontend/mfm] Use double.TryParse instead of try/catch
This commit is contained in:
parent
dd768242e1
commit
2b124f9e34
1 changed files with 1 additions and 8 deletions
|
@ -536,14 +536,7 @@ public static partial class MfmRenderer
|
||||||
if (childText == null) return el;
|
if (childText == null) return el;
|
||||||
|
|
||||||
double timestamp;
|
double timestamp;
|
||||||
try
|
if (!double.TryParse(childText, out timestamp)) return el;
|
||||||
{
|
|
||||||
timestamp = double.Parse(childText);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
|
|
||||||
var date = DateTime.UnixEpoch.AddSeconds(timestamp);
|
var date = DateTime.UnixEpoch.AddSeconds(timestamp);
|
||||||
el.SetAttribute("datetime", date.ToLocalTime().ToString("O"));
|
el.SetAttribute("datetime", date.ToLocalTime().ToString("O"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue