From: Andrew Garrett Date: Mon, 27 Nov 2006 03:09:35 +0000 (+0000) Subject: Make passing an invalid revid for undoing fail gracefully X-Git-Tag: 1.31.0-rc.0~55068 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=1f7fb3a5031f838e2999098228f3777c08333376;p=lhc%2Fweb%2Fwiklou.git Make passing an invalid revid for undoing fail gracefully --- diff --git a/includes/EditPage.php b/includes/EditPage.php index bf24b84359..f655c5b9df 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -101,11 +101,11 @@ class EditPage { #Undoing a specific edit overrides section editing; section-editing # doesn't work with undoing. $undorev = Revision::newFromId($undo); - $oldrev = $undorev->getPrevious(); #Sanity check, make sure it's the right page. # Otherwise, $text will be left as-is. - if ($undorev->getPage() == $this->mArticle->getID()) { + if (!is_null($undorev) && $undorev->getPage() == $this->mArticle->getID()) { + $oldrev = $undorev->getPrevious(); $undorev_text = $undorev->getText(); $oldrev_text = $oldrev->getText(); $currev_text = $text;