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
global $wgContLang;
$mto = $file->transform( [ 'width' => 120 ] );
global $wgContLang;
$mto = $file->transform( [ 'width' => 120 ] );
- $this->addHeaderText(
- '<div class="thumb t' . $wgContLang->alignEnd() . '">' .
- Html::element( 'img', [
- 'src' => $mto->getUrl(),
- 'class' => 'thumbimage',
- ] ) . '</div>', 'description' );
+ if ( $mto ) {
+ $this->addHeaderText(
+ '<div class="thumb t' . $wgContLang->alignEnd() . '">' .
+ Html::element( 'img', [
+ 'src' => $mto->getUrl(),
+ 'class' => 'thumbimage',
+ ] ) . '</div>', 'description' );
+ }