From 1b47be2d1fde5a10cdb6318d3df84c2b73c3440e Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Tue, 12 Mar 2013 11:17:43 -0400 Subject: [PATCH] check parsed floats for NaN in media info providers --- MediaBrowser.Controller/MediaBrowser.Controller.csproj | 2 +- .../MediaInfo/ffmpeg20130310.zip.REMOVED.git-id | 1 - .../MediaInfo/ffmpeg20130312.zip.REMOVED.git-id | 1 + .../Providers/MediaInfo/BaseFFProbeProvider.cs | 8 ++++++-- 4 files changed, 8 insertions(+), 4 deletions(-) delete mode 100644 MediaBrowser.Controller/MediaInfo/ffmpeg20130310.zip.REMOVED.git-id create mode 100644 MediaBrowser.Controller/MediaInfo/ffmpeg20130312.zip.REMOVED.git-id diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 54ba9be55..1485b51f9 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -201,7 +201,7 @@ - + diff --git a/MediaBrowser.Controller/MediaInfo/ffmpeg20130310.zip.REMOVED.git-id b/MediaBrowser.Controller/MediaInfo/ffmpeg20130310.zip.REMOVED.git-id deleted file mode 100644 index 830011a04..000000000 --- a/MediaBrowser.Controller/MediaInfo/ffmpeg20130310.zip.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a005e50576665b191cbd02b42d6260bffb764690 \ No newline at end of file diff --git a/MediaBrowser.Controller/MediaInfo/ffmpeg20130312.zip.REMOVED.git-id b/MediaBrowser.Controller/MediaInfo/ffmpeg20130312.zip.REMOVED.git-id new file mode 100644 index 000000000..ee5c29231 --- /dev/null +++ b/MediaBrowser.Controller/MediaInfo/ffmpeg20130312.zip.REMOVED.git-id @@ -0,0 +1 @@ +629771e1793534eea1b867e8333f22a829acc35f \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs index 253d4dfed..d09ca705c 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs @@ -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;