Skip to content

Apache Lucene open-source search software

stop emitting warning about undefined variable $1 in the case of no leading text to trim from a line (i.e. $type is empty and there is no leading whitespace)

Steven Rowe2cb0a5c0dabf
diff --git a/lucene/site/changes/changes2html.pl b/lucene/site/changes/changes2html.pl
index 2c72f45bf2e..fd94f4a13bb 100755
--- a/lucene/site/changes/changes2html.pl
+++ b/lucene/site/changes/changes2html.pl
@@ -195,7 +195,7 @@ for (my $line_num = 0 ; $line_num <= $#lines ; ++$line_num) {
my $line;
my $item = $_;
$item =~ s/^(\s*\Q$type\E\s*)//; # Trim the leading bullet
- my $leading_ws_width = length($1);
+ my $leading_ws_width = defined($1) ? length($1) : 0;
$item =~ s/\s+$//; # Trim trailing whitespace
$item .= "\n";