summaryrefslogtreecommitdiff
path: root/includes/filerepo/FileRepo.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/filerepo/FileRepo.php')
-rw-r--r--includes/filerepo/FileRepo.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index 5b42c2c6..cef1176d 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() );