From e45a97c2ae50b2efc5f20c5035920baa53193045 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Thu, 12 Aug 2021 18:02:50 -0700 Subject: [PATCH] added error check for undefined opening token --- lib/Perl/Tidy/Formatter.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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(<