From 3d40a861b4e77f04df7196cffda5b41b9852b2c7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 Jan 2022 22:24:06 +0100 Subject: Fix crashes when using kdm_cli with a certificate instead of a cinema. --- src/lib/kdm_cli.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib/kdm_cli.cc') 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(name_values, i->cinema.get(), i->cinema->emails, kdm)); + kdms.push_back (make_shared(name_values, i->cinema.get(), i->cinema ? i->cinema->emails : list(), kdm)); } write_files (kdms, zip, output, container_name_format, filename_format, verbose, out); if (email) { -- cgit v1.2.3