Don't emit bogus PDF if there's an input error.

This commit is contained in:
Dianne Skoll
2022-01-27 21:37:33 -05:00
parent ff58c7f699
commit ae90243352

View File

@@ -111,7 +111,9 @@ if (-t STDIN) {
my $done_one = 0;
my $surface = Cairo::PdfSurface->create_for_stream(sub { print $_[1]; }, undef,
my $errored_out = 0;
my $surface = Cairo::PdfSurface->create_for_stream(sub { print $_[1] unless $errored_out; }, undef,
$settings->{width}, $settings->{height});
$surface->set_metadata('title', 'Calendar');
@@ -132,6 +134,7 @@ while(1) {
if (!$obj) {
if (!$done_one) {
$errored_out = 1;
print STDERR "$err\n";
exit(1);
}