From 5cbf1958d7db0169f075dda2009b549c177697e3 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 9 Jul 2015 15:59:48 -0700 Subject: [PATCH] Fixed BadMethodCallException in FileRepo for bad titles * Fixes regression from 7508b86ad3 Change-Id: I60c106b5b27db067b1884af95f5fb74a0a682a9a --- includes/filerepo/FileRepo.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index e66fdafb40..5bac289da9 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -431,7 +431,9 @@ class FileRepo { # Now try an old version of the file if ( $time !== false ) { $img = $this->newFile( $title, $time ); - $img->load( $flags ); + if ( $img ) { + $img->load( $flags ); + } if ( $img && $img->exists() ) { if ( !$img->isDeleted( File::DELETED_FILE ) ) { return $img; // always OK @@ -452,10 +454,10 @@ class FileRepo { $redir = $this->checkRedirect( $title ); if ( $redir && $title->getNamespace() == NS_FILE ) { $img = $this->newFile( $redir ); - $img->load( $flags ); if ( !$img ) { return false; } + $img->load( $flags ); if ( $img->exists() ) { $img->redirectedFrom( $title->getDBkey() ); -- 2.20.1