mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 06:23:03 +03:00
Optimize tryparse
* Don't check for null before * Don't try different formats when not needed (NumberFormat.Integer is the fast path)
This commit is contained in:
@@ -315,12 +315,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
if (float.TryParse(text, CultureInfo.InvariantCulture, out var value))
|
||||
{
|
||||
if (float.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out var value))
|
||||
{
|
||||
item.CriticRating = value;
|
||||
}
|
||||
item.CriticRating = value;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user