Add used message keys to ContentHandler::getLocalizedName
[lhc/web/wiklou.git] / includes / content / ContentHandler.php
index 2a92e23..89ef4e4 100644 (file)
@@ -354,6 +354,8 @@ abstract class ContentHandler {
         * @throws MWException if the model id isn't known.
         */
        public static function getLocalizedName( $name ) {
+               // Messages: content-model-wikitext, content-model-text,
+               // content-model-javascript, content-model-css
                $key = "content-model-$name";
 
                $msg = wfMessage( $key );
@@ -907,6 +909,10 @@ abstract class ContentHandler {
                $undo_content = $undo->getContent();
                $undoafter_content = $undoafter->getContent();
 
+               if ( !$undo_content || !$undoafter_content ) {
+                       return false; // no content to undo
+               }
+
                $this->checkModelID( $cur_content->getModel() );
                $this->checkModelID( $undo_content->getModel() );
                $this->checkModelID( $undoafter_content->getModel() );