From e35d2120a831fe6ccd993a4f86eac084e057e78d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 8 Jun 2018 11:47:39 +0100 Subject: [PATCH] Fix crash with missing DCP content. --- src/lib/dcp_content.cc | 3 +++ src/lib/dcp_decoder.cc | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 1dffa6b36..ad1f07718 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -541,6 +541,9 @@ DCPContent::can_reference_audio (string& why_not) const } catch (dcp::DCPReadError) { /* We couldn't read the DCP, so it's probably missing */ return false; + } catch (DCPError) { + /* We couldn't read the DCP, so it's probably missing */ + return false; } catch (dcp::KDMDecryptionError) { /* We have an incorrect KDM */ return false; diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 5f06501b6..2433ad0fb 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -44,6 +44,8 @@ #include #include +#include "i18n.h" + using std::list; using std::cout; using boost::shared_ptr; @@ -65,8 +67,14 @@ DCPDecoder::DCPDecoder (shared_ptr c, shared_ptr log, boo subtitle.reset (new SubtitleDecoder (this, c->subtitle, log, ContentTime())); } + list > cpl_list = cpls (); + + if (cpl_list.empty()) { + throw DCPError (_("No CPLs found in DCP.")); + } + shared_ptr cpl; - BOOST_FOREACH (shared_ptr i, cpls ()) { + BOOST_FOREACH (shared_ptr i, cpl_list) { if (_dcp_content->cpl() && i->id() == _dcp_content->cpl().get()) { cpl = i; } -- 2.30.2