Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -175,7 +175,12 @@ |
176 | 176 | */ |
177 | 177 | function performStash() { |
178 | 178 | try { |
179 | | - $fileKey = $this->mUpload->stashFile()->getFileKey(); |
| 179 | + $stashFile = $this->mUpload->stashFile(); |
| 180 | + |
| 181 | + if ( !$stashFile ) { |
| 182 | + throw new MWException( 'Invalid stashed file' ); |
| 183 | + } |
| 184 | + $fileKey = $stashFile->getFileKey(); |
180 | 185 | } catch ( MWException $e ) { |
181 | 186 | $message = 'Stashing temporary file failed: ' . get_class( $e ) . ' ' . $e->getMessage(); |
182 | 187 | wfDebug( __METHOD__ . ' ' . $message . "\n"); |