From 0acd045b0e911427db96dbd186d551ab9f96c4fc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 21 Sep 2016 22:23:06 +0100 Subject: Don't throw an exception on trying to create a KDM for a CPL with non-encrypted parts. --- src/decrypted_kdm.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index 05ea73a3..c9c58951 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -236,16 +236,19 @@ DecryptedKDM::DecryptedKDM ( , _issue_date (issue_date) { /* Create DecryptedKDMKey objects for each encryptable asset */ + bool did_one = false; BOOST_FOREACH(shared_ptr i, cpl->reel_assets ()) { shared_ptr mxf = boost::dynamic_pointer_cast (i); shared_ptr asset = boost::dynamic_pointer_cast (i); - if (asset && mxf) { - if (!mxf->key_id ()) { - throw NotEncryptedError (asset->id ()); - } + if (asset && mxf && mxf->key_id ()) { _keys.push_back (DecryptedKDMKey (mxf->key_type(), mxf->key_id().get(), key, cpl->id ())); + did_one = true; } } + + if (!did_one) { + throw NotEncryptedError (cpl->id ()); + } } /** @param type (MDIK, MDAK etc.) -- cgit v1.2.3