Partial correctness fix; use lazy-loading $this->getTitle() instead of $this->mTitle...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 8 May 2008 19:26:41 +0000 (19:26 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 8 May 2008 19:26:41 +0000 (19:26 +0000)
This will ensure they work even if the objects were fetched in a way that didn't initialize $this->mTitle... unless they aren't fully saved in the DB, in which case they'll still fail with a fatal error.

includes/Revision.php

index 9e473c2..f704846 100644 (file)
@@ -536,7 +536,7 @@ class Revision {
         * @return Revision
         */
        public function getPrevious() {
-               $prev = $this->mTitle->getPreviousRevisionID( $this->mId );
+               $prev = $this->getTitle()->getPreviousRevisionID( $this->mId );
                if( $prev ) {
                        return Revision::newFromTitle( $this->mTitle, $prev );
                } else {
@@ -548,7 +548,7 @@ class Revision {
         * @return Revision
         */
        public function getNext() {
-               $next = $this->mTitle->getNextRevisionID( $this->mId );
+               $next = $this->getTitle()->getNextRevisionID( $this->mId );
                if ( $next ) {
                        return Revision::newFromTitle( $this->mTitle, $next );
                } else {