Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2954,6 +2954,7 @@ |
2955 | 2955 | /** |
2956 | 2956 | * Find a file. |
2957 | 2957 | * Shortcut for RepoGroup::singleton()->findFile() |
| 2958 | + * @param $title Either a string or Title object |
2958 | 2959 | * @param $options Associative array of options: |
2959 | 2960 | * time: requested time for an archived image, or false for the |
2960 | 2961 | * current version. An image object will be returned which was |
— | — | @@ -2976,6 +2977,8 @@ |
2977 | 2978 | /** |
2978 | 2979 | * Get an object referring to a locally registered file. |
2979 | 2980 | * Returns a valid placeholder object if the file does not exist. |
| 2981 | + * @param $title Either a string or Title object |
| 2982 | + * @return File, or null if passed an invalid Title |
2980 | 2983 | */ |
2981 | 2984 | function wfLocalFile( $title ) { |
2982 | 2985 | return RepoGroup::singleton()->getLocalRepo()->newFile( $title ); |
Index: trunk/phase3/includes/specials/SpecialListfiles.php |
— | — | @@ -133,6 +133,10 @@ |
134 | 134 | $name = $this->mCurrentRow->img_name; |
135 | 135 | $link = $this->getSkin()->linkKnown( Title::makeTitle( NS_FILE, $name ), $value ); |
136 | 136 | $image = wfLocalFile( $value ); |
| 137 | + if( !$image ) { |
| 138 | + wfDebug( __METHOD__ . " was passed a bogus title '$value'" ); |
| 139 | + return ''; |
| 140 | + } |
137 | 141 | $url = $image->getURL(); |
138 | 142 | $download = Xml::element('a', array( 'href' => $url ), $imgfile ); |
139 | 143 | return "$link ($download)"; |