]> git.donarmstrong.com Git - perltidy.git/commitdiff
put a reasonable limit of 100 on weld cutoff level
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 13 Nov 2021 00:24:32 +0000 (16:24 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 13 Nov 2021 00:24:32 +0000 (16:24 -0800)
lib/Perl/Tidy/Formatter.pm

index 793e2b996aac47caf80037fa52fed36265ceb94d..242b81f38d80bd87f8a743bc62ce8a2c7c70fb94 100644 (file)
@@ -1846,7 +1846,12 @@ EOM
     # Cases b1197-b1204 work ok with const=12 but not with const=8
     my $const = 16;
     $stress_level = 0;
-    foreach my $level ( 0 .. $level_max ) {
+
+    # Put a reasonable limit on stress level (say 100) in case the
+    # whitespace-cycle variable is used.
+    my $stress_level_limit = min( 100, $level_max );
+
+    foreach my $level ( 0 .. $stress_level_limit ) {
         my $remaining_cycles = max(
             0,
             (