From a1081269f16bc1a7f23f237ab06a677dd32bf2a5 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 3 Apr 2020 07:10:20 -0700 Subject: [PATCH] fixed undefined var --- lib/Perl/Tidy/Formatter.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 284c5744..7f59c627 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -6926,13 +6926,16 @@ sub tight_paren_follows { # Never break a simple parenthesized do of the form ( do { ... } ) my $K_test = $self->K_next_nonblank($K_oo); - if ( $K_test < $K_io ) { $K_test = $self->K_next_nonblank($K_test); } + return unless defined($K_test); + if ( $K_test < $K_io ) { $K_test = $self->K_next_nonblank($K_test); } + return unless defined($K_test); if ( $K_test == $K_io ) { return 1 } # Never break before a closing signature paren. # This is a fix for issue git#22. # sub xxx ( ... do { ... } ) { $K_test = $self->K_next_nonblank($K_oc); + return unless defined($K_test); my $block_type = $rLL->[$K_test]->[_BLOCK_TYPE_]; if ( $block_type @@ -6947,6 +6950,7 @@ sub tight_paren_follows { # If there are intervening container item(s) between the outer '(' and # the innier '{' then this is considered a complex statement $K_test = $rLL->[$K_oo]->[_KNEXT_SEQ_ITEM_]; + return unless defined($K_test); if ( $K_test != $K_io ) { return; } -- 2.39.5