From 77c17910a9f3bf145c65025e45de9b3247cdb224 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 19 Jan 2006 17:12:37 +0000 Subject: [PATCH] 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. --- includes/Revision.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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; + } } /**#@-*/ -- 2.20.1