From: Steve Hancock Date: Fri, 13 Aug 2021 01:02:50 +0000 (-0700) Subject: added error check for undefined opening token X-Git-Tag: 20210717.02~51 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e45a97c2ae50b2efc5f20c5035920baa53193045;p=perltidy.git added error check for undefined opening token --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index eb969ae0..82b11194 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -4741,10 +4741,18 @@ EOM my $opening_depth = $rdepth_of_opening_seqno->[$seqno]; if ( !defined($opening_depth) ) { - $opening_depth = $nesting_depth--; + $opening_depth = $nesting_depth - 1; $opening_depth = 0 if ( $opening_depth < 0 ); $rdepth_of_opening_seqno->[$seqno] = $opening_depth; + + # This is not fatal but should not happen. There + # may be a problem in the tokenizer. + if (DEVEL_MODE) { + Fault(<