X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fdcp_examiner.cc;h=5de8c89050caf391ed57848e64d433ed9414f7e9;hp=8fa41a8a59d536dfe899d9cf0bd54a75a8dfebaa;hb=0f9f004c50a8bea6b87d5a1636f95f67066e5187;hpb=dba3b79e848c70e405e41744c40b416014e86eb8 diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 8fa41a8a5..5de8c8905 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -72,12 +72,12 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) auto cpls = dcp::find_and_resolve_cpls (content->directories(), tolerant); if (content->cpl ()) { - /* Use the CPL that the content was using before */ - for (auto i: cpls) { - if (i->id() == content->cpl().get()) { - cpl = i; - } + /* Use the CPL that was specified, or that the content was using before */ + auto iter = std::find_if(cpls.begin(), cpls.end(), [content](shared_ptr cpl) { return cpl->id() == content->cpl().get(); }); + if (iter == cpls.end()) { + throw CPLNotFoundError(content->cpl().get()); } + cpl = *iter; } else { /* Choose the CPL with the fewest unsatisfied references */