summaryrefslogtreecommitdiff
path: root/core/display.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/display.js')
-rw-r--r--core/display.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/display.js b/core/display.js
index c895717..3dd5fce 100644
--- a/core/display.js
+++ b/core/display.js
@@ -360,8 +360,14 @@ export default class Display {
}
imageRect(x, y, width, height, mime, arr) {
+ /* The internal logic cannot handle empty images, so bail early */
+ if ((width === 0) || (height === 0)) {
+ return;
+ }
+
const img = new Image();
img.src = "data: " + mime + ";base64," + Base64.encode(arr);
+
this._renderQ_push({
'type': 'img',
'img': img,
@@ -617,7 +623,8 @@ export default class Display {
this.blitRgbxImage(a.x, a.y, a.width, a.height, a.data, 0, true);
break;
case 'img':
- if (a.img.complete) {
+ /* IE tends to set "complete" prematurely, so check dimensions */
+ if (a.img.complete && (a.img.width !== 0) && (a.img.height !== 0)) {
if (a.img.width !== a.width || a.img.height !== a.height) {
Log.Error("Decoded image has incorrect dimensions. Got " +
a.img.width + "x" + a.img.height + ". Expected " +