From: Aaron Schulz Date: Sun, 27 Mar 2011 14:41:11 +0000 (+0000) Subject: Don't assume newFileFromKey always returns a File object (some repos many not support... X-Git-Tag: 1.31.0-rc.0~31163 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=3a9752aad0ca0afb07fad348813d1b1bd5d8e419;p=lhc%2Fweb%2Fwiklou.git Don't assume newFileFromKey always returns a File object (some repos many not support fetch by time or sha1 and return false) --- 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) ) {