Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/84129


Change subject: quick fix for weird image failure mode
......................................................................

quick fix for weird image failure mode

Change-Id: If808952877a9a541b9015ca542861882fd257251
---
M WikipediaMetro/WikipediaMetroTest/js/default.js
1 file changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/win8/wikipedia 
refs/changes/29/84129/1

diff --git a/WikipediaMetro/WikipediaMetroTest/js/default.js 
b/WikipediaMetro/WikipediaMetroTest/js/default.js
index 86bcd64..3cf1872 100644
--- a/WikipediaMetro/WikipediaMetroTest/js/default.js
+++ b/WikipediaMetro/WikipediaMetroTest/js/default.js
@@ -968,12 +968,14 @@
         if (height > image.height) {
             height = image.height;
         }
-        ctx.drawImage(image,
-            // source
-            Math.floor((image.width - width) / 2), Math.floor((image.height - 
height) / 2), width, height,
-            // dest
-            0, 0, width, height
-        );
+        if (width > 0 && height > 0) {
+            ctx.drawImage(image,
+                // source
+                Math.floor((image.width - width) / 2), 
Math.floor((image.height - height) / 2), width, height,
+                // dest
+                0, 0, width, height
+            );
+        }
         return canvas.toDataURL();
     }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If808952877a9a541b9015ca542861882fd257251
Gerrit-PatchSet: 1
Gerrit-Project: apps/win8/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to