From 3a9752aad0ca0afb07fad348813d1b1bd5d8e419 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 27 Mar 2011 14:41:11 +0000 Subject: [PATCH] Don't assume newFileFromKey always returns a File object (some repos many not support fetch by time or sha1 and return false) --- includes/filerepo/FileRepo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index defb67d22e..6e4d12f372 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -224,7 +224,7 @@ abstract class FileRepo { # Now try an old version of the file if ( $time !== false ) { $img = $this->newFileFromKey( $sha1, $time ); - if ( $img->exists() ) { + if ( $img && $img->exists() ) { if ( !$img->isDeleted(File::DELETED_FILE) ) { return $img; } else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) { -- 2.20.1