]> git.donarmstrong.com Git - perltidy.git/commitdiff
fixed unitialized variable problem
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 13 Sep 2020 22:46:59 +0000 (15:46 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 13 Sep 2020 22:46:59 +0000 (15:46 -0700)
lib/Perl/Tidy/Formatter.pm

index 2cba7e0cbee4b814f7639290fe73762d4c5aefab..06136cb9bb4370b34410f29fd95ef0a4be109df5 100644 (file)
@@ -11922,7 +11922,12 @@ sub lookup_opening_indentation {
             # handle option to indent non-blocks of the form );  };  ];
             # But don't do special indentation to something like ')->pack('
             if ( !$block_type_to_go[$ibeg] ) {
-                my $cti = $closing_token_indentation{ $tokens_to_go[$ibeg] };
+
+               # Note that logical padding has already been applied, so we may
+               # need to remove some spaces to get a valid hash key.
+                my $tok = $tokens_to_go[$ibeg];
+                if ( length($tok) > 1 ) { $tok =~ s/\s//g }
+                my $cti = $closing_token_indentation{ $tok };
                 if ( $cti == 1 ) {
                     if (   $i_terminal <= $ibeg + 1
                         || $is_semicolon_terminated )