From 1645a14677bb3b02ed076034d79208aa6798e878 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 27 Mar 2022 17:50:03 -0700 Subject: [PATCH] fix minor initialization error, issue c131 --- lib/Perl/Tidy/Formatter.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index e41de5bb..c6dde728 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -18253,9 +18253,25 @@ sub break_long_lines { # prevent following the old breakpoints with the # -iob flag. my ( $self, $dd, $rcomma_bias_to_go ) = @_; + + # Check added for issue c131; an error here would be due to an + # error initializing @comma_index when entering depth $dd. + if (DEVEL_MODE) { + foreach my $ii ( @{ $comma_index[$dd] } ) { + if ( $ii < 0 || $ii > $max_index_to_go ) { + my $KK = $K_to_go[0]; + my $lno = $self->[_rLL_]->[$KK]->[_LINE_INDEX_]; + Fault(<[$ii] = $bias; @@ -18777,6 +18793,7 @@ EOM $index_before_arrow[$depth] = -1; $interrupted_list[$depth] = 0; $item_count_stack[$depth] = 0; + $comma_index[$depth] = undef; $last_comma_index[$depth] = undef; $last_dot_index[$depth] = undef; $last_nonblank_type[$depth] = $last_nonblank_type; -- 2.39.5