Make Revision::getPrevious() and Revision::getNext() return null if there are no...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 19 Jan 2006 17:12:37 +0000 (17:12 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 19 Jan 2006 17:12:37 +0000 (17:12 +0000)
includes/Revision.php

index c390df0..0398a9b 100644 (file)
@@ -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;
+               }
        }
        /**#@-*/