From: Steve Hancock Date: Fri, 20 Jan 2023 01:03:38 +0000 (-0800) Subject: fix non-fatal internal fault check c177 X-Git-Tag: 20221112.04~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b2fd28f367ab0c2159db83024f7d9892c9304854;p=perltidy.git fix non-fatal internal fault check c177 add check to avoid creating an empty batch --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 7fe237ec..efca6d13 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -14971,13 +14971,16 @@ EOM # to add a blank. The value of the flag is as follows: # 1 => hard break, flush the batch # 2 => soft break, set breakpoint and continue building the batch - if ( $self->[_rbreak_before_Kfirst_]->{$K_first_true} ) { + # added check on max_index_to_go for c177 + if ( $max_index_to_go >= 0 + && $self->[_rbreak_before_Kfirst_]->{$K_first_true} ) + { $index_start_one_line_block = undef; if ( $self->[_rbreak_before_Kfirst_]->{$K_first_true} == 2 ) { $self->set_forced_breakpoint($max_index_to_go); } else { - $self->end_batch() if ( $max_index_to_go >= 0 ); + $self->end_batch(); } } }