Article: Show error message when Revision::getContent() fails
authorKevin Israel <pleasestand@live.com>
Mon, 15 Sep 2014 09:44:35 +0000 (05:44 -0400)
committerKevin Israel <pleasestand@live.com>
Thu, 15 Jan 2015 00:11:11 +0000 (19:11 -0500)
It already checks for other errors though not this specific one
(e.g. missing text row or external storage row).

Change-Id: Id9eed4bd3d8241d445b15948f1544040394012c3

includes/page/Article.php

index 9ce3854..0fc251e 100644 (file)
@@ -410,10 +410,18 @@ class Article implements Page {
                // @todo FIXME: Horrible, horrible! This content-loading interface just plain sucks.
                // We should instead work with the Revision object when we need it...
                // Loads if user is allowed
-               $this->mContentObject = $this->mRevision->getContent(
+               $content = $this->mRevision->getContent(
                        Revision::FOR_THIS_USER,
                        $this->getContext()->getUser()
                );
+
+               if ( !$content ) {
+                       wfDebug( __METHOD__ . " failed to retrieve content of revision " .
+                               $this->mRevision->getId() . "\n" );
+                       return false;
+               }
+
+               $this->mContentObject = $content;
                $this->mRevIdFetched = $this->mRevision->getId();
 
                Hooks::run( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) );