diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-09 22:24:06 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-01-11 09:33:59 +0100 |
| commit | 3d40a861b4e77f04df7196cffda5b41b9852b2c7 (patch) | |
| tree | e3820139e14f0f82ed88b2bc18d14959a6c26ab0 /src/lib/kdm_cli.cc | |
| parent | b1ef870b61528feb0d72ed9d7fe54447b3b5c7db (diff) | |
Fix crashes when using kdm_cli with a certificate instead of a cinema.
Diffstat (limited to 'src/lib/kdm_cli.cc')
| -rw-r--r-- | src/lib/kdm_cli.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index e9a3651ba..e6ba600f4 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -354,8 +354,11 @@ from_dkdm ( continue; } - dcp::LocalTime begin(valid_from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); - dcp::LocalTime end(valid_to, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); + int const offset_hour = i->cinema ? i->cinema->utc_offset_hour() : 0; + int const offset_minute = i->cinema ? i->cinema->utc_offset_minute() : 0; + + dcp::LocalTime begin(valid_from, offset_hour, offset_minute); + dcp::LocalTime end(valid_to, offset_hour, offset_minute); auto const kdm = kdm_from_dkdm( dkdm, @@ -369,14 +372,14 @@ from_dkdm ( ); dcp::NameFormat::Map name_values; - name_values['c'] = i->cinema->name; + name_values['c'] = i->cinema ? i->cinema->name : ""; name_values['s'] = i->name; name_values['f'] = dkdm.annotation_text().get_value_or(""); name_values['b'] = begin.date() + " " + begin.time_of_day(true, false); name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - kdms.push_back (make_shared<KDMWithMetadata>(name_values, i->cinema.get(), i->cinema->emails, kdm)); + kdms.push_back (make_shared<KDMWithMetadata>(name_values, i->cinema.get(), i->cinema ? i->cinema->emails : list<string>(), kdm)); } write_files (kdms, zip, output, container_name_format, filename_format, verbose, out); if (email) { |
