Permalink
Browse files

Item14195: Prevent loop in UI/View under some conditions

  • Loading branch information...
1 parent a20b737 commit 28fd71f27e32c29171dae4b207b59e99bbbbafb9 @gac410 gac410 committed Sep 18, 2016
Showing with 4 additions and 2 deletions.
  1. +4 −2 core/lib/Foswiki/UI/View.pm
@@ -308,9 +308,11 @@ sub view {
}
# Show revisions around the one being displayed.
- $tmpl =~ s/%REVISIONS%/
+ if ( index( $tmpl, '%REVISIONS%' ) >= 0 ) {
+ $tmpl =~ s/%REVISIONS%/
revisionsAround(
$session, $topicObject, $requestedRev, $showRev, $maxRev)/e;
+ }
## SMELL: This is also used in Foswiki::_TOC. Could insert a tag in
## TOC and remove all those here, finding the parameters only once
@@ -514,7 +516,7 @@ sub revisionsAround {
my $showIndex = $#revs;
my $left = 0;
my $right = $Foswiki::cfg{NumberOfRevisions};
- if ($requestedRev) {
+ if ( $requestedRev && $showIndex >= 0 ) {
while ( $showIndex && $revs[$showIndex] != $showRev ) {
$showIndex--;
}

0 comments on commit 28fd71f

Please sign in to comment.