Avoid fatal in ContentHandler::getUndoContent by null content
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 5 Nov 2013 19:37:45 +0000 (20:37 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Tue, 5 Nov 2013 19:37:45 +0000 (20:37 +0100)
Revision::getContent can return null, which would here result in a fatal
error. Return false to indicate that this undo is not possible.

Change-Id: I6f6b4b59e86f9762f61c50dd65f81a7256c5255a

includes/content/ContentHandler.php

index 2a92e23..8991290 100644 (file)
@@ -907,6 +907,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() );