check parsed floats for NaN in media info providers

This commit is contained in:
LukePulverenti
2013-03-12 11:17:43 -04:00
parent 40501ac1f3
commit 1b47be2d1f
4 changed files with 8 additions and 4 deletions

View File

@@ -262,11 +262,15 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
{
var parts = value.Split('/');
float result;
if (parts.Length == 2)
{
return float.Parse(parts[0]) / float.Parse(parts[1]);
result = float.Parse(parts[0]) / float.Parse(parts[1]);
}
return float.Parse(parts[0]);
result = float.Parse(parts[0]);
return float.IsNaN(result) ? (float?)null : result;
}
return null;