jenkins-bot has submitted this change and it was merged.

Change subject: Fix exception if image passed to models is a boolean
......................................................................


Fix exception if image passed to models is a boolean

Some "false" propagates to the $collection->file and it ends up exploding here
in this if... Probably coming from the api.

Bug: T98545
Change-Id: I9edf368f033ee762e2be32ebed9a7e01f6e13501
---
M includes/models/Image.php
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/models/Image.php b/includes/models/Image.php
index 3061d1b..4b3624a 100644
--- a/includes/models/Image.php
+++ b/includes/models/Image.php
@@ -14,11 +14,12 @@
        const SHARING_THUMBNAIL_WIDTH = 360;
 
        /**
+        * @param File $image
         * @param int $size
         * @return bool|\MediaTransformOutput
         */
        public static function getThumbnail( $image, $size = 
self::SHARING_THUMBNAIL_WIDTH ) {
-               if ( $image !== null ) {
+               if ( $image ) {
                        $thumb = $image->transform( array( 'width' => $size ) );
                        if ( $thumb && $thumb->getUrl() ) {
                                return $thumb;

-- 
To view, visit https://gerrit.wikimedia.org/r/209664
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9edf368f033ee762e2be32ebed9a7e01f6e13501
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to