Skip to content

Commit

Permalink
Item14195: Prevent loop in UI/View under some conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Sep 18, 2016
1 parent a20b737 commit 28fd71f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/lib/Foswiki/UI/View.pm
Expand Up @@ -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
Expand Down Expand Up @@ -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--;
}
Expand Down

0 comments on commit 28fd71f

Please sign in to comment.