From: Tim Starling Date: Thu, 19 Jan 2006 17:12:37 +0000 (+0000) Subject: Make Revision::getPrevious() and Revision::getNext() return null if there are no... X-Git-Tag: 1.6.0~477 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=77c17910a9f3bf145c65025e45de9b3247cdb224;p=lhc%2Fweb%2Fwiklou.git Make Revision::getPrevious() and Revision::getNext() return null if there are no more revisions to fetch in that direction. They previously just started from the current revision again. --- diff --git a/includes/Revision.php b/includes/Revision.php index c390df0636..0398a9baf4 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -395,7 +395,11 @@ class Revision { */ function getPrevious() { $prev = $this->mTitle->getPreviousRevisionID( $this->mId ); - return Revision::newFromTitle( $this->mTitle, $prev ); + if ( $prev ) { + return Revision::newFromTitle( $this->mTitle, $prev ); + } else { + return null; + } } /** @@ -403,7 +407,11 @@ class Revision { */ function getNext() { $next = $this->mTitle->getNextRevisionID( $this->mId ); - return Revision::newFromTitle( $this->mTitle, $next ); + if ( $next ) { + return Revision::newFromTitle( $this->mTitle, $next ); + } else { + return null; + } } /**#@-*/