cf: check for undefined variables

The w32-hh-toc-from-info.pl script would fail with more recent versions
of Perl, as it attempted to access undefined variables.
This commit is contained in:
Luke Howard
2021-08-11 23:31:38 +10:00
parent 1175fa0435
commit 2f4619fbbd

View File

@@ -56,7 +56,9 @@ my $tree = HTML::TreeBuilder->new();
$tree->parse_file($input_file);
my $contents = $tree->look_down('class', 'contents');
my $clist = $contents->find_by_tag_name('ul');
if (defined($contents)) {
my $clist = $contents->find_by_tag_name('ul');
}
print TOC '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
@@ -79,6 +81,8 @@ sub process_ul_element
my $e = shift;
my $level = shift;
return unless defined($e);
if ($e->tag() eq "ul") {
print TOC ' 'x$level;