From f8c88aa632a91f3ca497fcb762f358410a490379 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 22 Dec 2016 10:58:31 -0500 Subject: [PATCH] add null checks --- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 23e63dad0..116a6a7cf 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -95,6 +95,11 @@ namespace MediaBrowser.MediaEncoding.Encoder int defaultImageExtractionTimeoutMs, bool enableEncoderFontFile, IEnvironmentInfo environmentInfo) { + if (jsonSerializer == null) + { + throw new ArgumentNullException("jsonSerializer"); + } + _logger = logger; _jsonSerializer = jsonSerializer; ConfigurationManager = configurationManager; @@ -632,7 +637,7 @@ namespace MediaBrowser.MediaEncoding.Encoder var result = _jsonSerializer.DeserializeFromStream(process.StandardOutput.BaseStream); - if (result.streams == null && result.format == null) + if (result == null || (result.streams == null && result.format == null)) { throw new Exception("ffprobe failed - streams and format are both null."); }