From: Steve Hancock Date: Tue, 8 Sep 2020 18:36:33 +0000 (-0700) Subject: fix undefined variable X-Git-Tag: 20200907.01~33 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9729965e8019650d60d1cb70d5e752b36db89925;p=perltidy.git fix undefined variable --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 3c8bd757..20f3fa5b 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -4018,10 +4018,13 @@ sub weld_cuddled_blocks { # We can weld the closing brace to its following word .. my $Ko = $K_closing_container->{$closing_seqno}; - my $Kon = $self->K_next_nonblank($Ko); + my $Kon; + if ( defined($Ko) ) { + $Kon = $self->K_next_nonblank($Ko); + } # ..unless it is a comment - if ( $rLL->[$Kon]->[_TYPE_] ne '#' ) { + if ( defined($Ko) && $rLL->[$Kon]->[_TYPE_] ne '#' ) { my $dlen = $rLL->[$Kon]->[_CUMULATIVE_LENGTH_] - $rLL->[ $Ko - 1 ]->[_CUMULATIVE_LENGTH_];