From 1f7fb3a5031f838e2999098228f3777c08333376 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Mon, 27 Nov 2006 03:09:35 +0000 Subject: [PATCH] Make passing an invalid revid for undoing fail gracefully --- includes/EditPage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.20.1