From 2f4619fbbdc8036e6ce90bf3411ebf3641f2470b Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Wed, 11 Aug 2021 23:31:38 +1000 Subject: [PATCH] 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. --- cf/w32-hh-toc-from-info.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cf/w32-hh-toc-from-info.pl b/cf/w32-hh-toc-from-info.pl index 2207c5cf4..9be8ef6e7 100644 --- a/cf/w32-hh-toc-from-info.pl +++ b/cf/w32-hh-toc-from-info.pl @@ -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 ' @@ -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;