]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix undefined variable
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 8 Sep 2020 18:36:33 +0000 (11:36 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 8 Sep 2020 18:36:33 +0000 (11:36 -0700)
lib/Perl/Tidy/Formatter.pm

index 3c8bd757c4d7e468a23b271a2c24a9819261a6ad..20f3fa5b9c62f65fe8c33eac1f0daf52ad082ebb 100644 (file)
@@ -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_];