aboutsummaryrefslogtreecommitdiffstats
path: root/includes/actions/RollbackAction.php
diff options
context:
space:
mode:
authorChad Horohoe <chadh@wikimedia.org>2016-08-26 17:01:53 -0700
committerChad Horohoe <chadh@wikimedia.org>2016-08-26 17:21:41 -0700
commit639a083d84a28e45c703ba79a127d93747233d98 (patch)
treec68c469554372b04699e4dbc2b1f05ad25b0d71a /includes/actions/RollbackAction.php
parent1a812d498c9032a3d16a4f52e900e3563801513a (diff)
downloadmediawikicore-639a083d84a28e45c703ba79a127d93747233d98.tar.gz
mediawikicore-639a083d84a28e45c703ba79a127d93747233d98.zip
Rollback: Catch error when unable to load latest revision data
Ideally this never happens, but it can, so fail gracefully instead of just throwing a 'call to a member function on non-object' message Change-Id: Iac8be9c7994aa3e74ed3c0eecff211524037165e
Diffstat (limited to 'includes/actions/RollbackAction.php')
-rw-r--r--includes/actions/RollbackAction.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php
index 3e760fd99b6f..3dc611b1ae41 100644
--- a/includes/actions/RollbackAction.php
+++ b/includes/actions/RollbackAction.php
@@ -57,6 +57,9 @@ class RollbackAction extends FormlessAction {
if ( $from === null || $from === '' ) {
throw new ErrorPageError( 'rollbackfailed', 'rollback-missingparam' );
}
+ if ( !$rev ) {
+ throw new ErrorPageError( 'rollbackfailed', 'rollback-missingrevision' );
+ }
if ( $from !== $rev->getUserText() ) {
throw new ErrorPageError( 'rollbackfailed', 'alreadyrolled', [
$this->getTitle()->getPrefixedText(),