Make passing an invalid revid for undoing fail gracefully
authorAndrew Garrett <werdna@users.mediawiki.org>
Mon, 27 Nov 2006 03:09:35 +0000 (03:09 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Mon, 27 Nov 2006 03:09:35 +0000 (03:09 +0000)
includes/EditPage.php

index bf24b84..f655c5b 100644 (file)
@@ -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;