EditPage: Throw exceptions on false contentModel
authoraddshore <addshorewiki@gmail.com>
Mon, 30 Jan 2017 17:29:00 +0000 (17:29 +0000)
committerAddshore <addshorewiki@gmail.com>
Wed, 22 Feb 2017 14:56:27 +0000 (14:56 +0000)
contentModel should always have a value here.

Change-Id: Iba2538f383de7da94bd0e0e3eb7d7eca4e6cee7c

includes/EditPage.php

index 34062c0..a45c889 100644 (file)
@@ -1256,7 +1256,7 @@ class EditPage {
                $revision = $this->mArticle->getRevisionFetched();
                if ( $revision === null ) {
                        if ( !$this->contentModel ) {
-                               $this->contentModel = $this->getTitle()->getContentModel();
+                               throw new RuntimeException( 'EditPage contentModel was false' );
                        }
                        $handler = ContentHandler::getForModelID( $this->contentModel );
 
@@ -1300,7 +1300,7 @@ class EditPage {
 
                if ( $content === false || $content === null ) {
                        if ( !$this->contentModel ) {
-                               $this->contentModel = $this->getTitle()->getContentModel();
+                               throw new RuntimeException( 'EditPage contentModel was false' );
                        }
                        $handler = ContentHandler::getForModelID( $this->contentModel );