From 29d07075d0ceed9c373a42969596e6a743b67a50 Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins.hb@gmail.com>
Date: Tue, 24 Jan 2017 10:59:58 -0700
Subject: [PATCH] decavcodec: fix crash in decavcodecvInfo

If avcodec_open fails, pv->context->codec is NULL, but work->info may
still be called by scan.

(cherry picked from commit 4425691a0fd57b30360d39df3bdeebb9cc9b577f)
---
 libhb/decavcodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index c81168d52..c8b12d770 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -1860,7 +1860,7 @@ static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info )
 
     memset( info, 0, sizeof(*info) );
 
-    if (pv->context == NULL)
+    if (pv->context == NULL || pv->context->codec == NULL)
         return 0;
 
     info->bitrate = pv->context->bit_rate;
-- 
2.40.0