Don't assume newFileFromKey always returns a File object (some repos many not support...
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 27 Mar 2011 14:41:11 +0000 (14:41 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 27 Mar 2011 14:41:11 +0000 (14:41 +0000)
includes/filerepo/FileRepo.php

index defb67d..6e4d12f 100644 (file)
@@ -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) ) {