From: Derk-Jan Hartman Date: Thu, 19 Jan 2017 19:49:55 +0000 (-0800) Subject: Special:Upload should not crash on failing previews X-Git-Tag: 1.31.0-rc.0~4267^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%24wgLogo?a=commitdiff_plain;h=01cdee5ffd21216859ef501e0887e027b21f682c;p=lhc%2Fweb%2Fwiklou.git Special:Upload should not crash on failing previews A thumbnail transformation can fail, but the preview on Special:Upload was not accounting for failed previews and caused a stacktrace on accessing getUrl on 'false'. Bug: T155771 Change-Id: Iff3a2ae3512a34a2d2efb981b7ea85da71aaf637 --- diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 8b8e514ac0..c5a1f27073 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -1090,12 +1090,14 @@ class UploadForm extends HTMLForm { global $wgContLang; $mto = $file->transform( [ 'width' => 120 ] ); - $this->addHeaderText( - '
' . - Html::element( 'img', [ - 'src' => $mto->getUrl(), - 'class' => 'thumbimage', - ] ) . '
', 'description' ); + if ( $mto ) { + $this->addHeaderText( + '
' . + Html::element( 'img', [ + 'src' => $mto->getUrl(), + 'class' => 'thumbimage', + ] ) . '
', 'description' ); + } } }