From 9729965e8019650d60d1cb70d5e752b36db89925 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 8 Sep 2020 11:36:33 -0700 Subject: [PATCH] fix undefined variable --- lib/Perl/Tidy/Formatter.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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_]; -- 2.39.5