From: umherirrender Date: Tue, 5 Nov 2013 19:37:45 +0000 (+0100) Subject: Avoid fatal in ContentHandler::getUndoContent by null content X-Git-Tag: 1.31.0-rc.0~18267^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=88ee6e03e6ba84f4b0ee9cb3e9cd8ccacc7199b7;p=lhc%2Fweb%2Fwiklou.git Avoid fatal in ContentHandler::getUndoContent by null content 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 --- diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 2a92e23389..8991290e7d 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -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() );