r84846 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84845‎ | r84846 | r84847 >
Date:14:41, 27 March 2011
Author:aaron
Status:ok
Tags:
Comment:
Don't assume newFileFromKey always returns a File object (some repos many not support fetch by time or sha1 and return false)
Modified paths:
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -224,7 +224,7 @@
225225 # Now try an old version of the file
226226 if ( $time !== false ) {
227227 $img = $this->newFileFromKey( $sha1, $time );
228 - if ( $img->exists() ) {
 228+ if ( $img && $img->exists() ) {
229229 if ( !$img->isDeleted(File::DELETED_FILE) ) {
230230 return $img;
231231 } else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {

Status & tagging log