From 2aed5896d1c1b3e4a8c451b15f957a72c90a1036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Fri, 4 Mar 2022 12:09:07 +0100 Subject: [PATCH] handle (some cases of) extent-less costumes --- HISTORY.md | 1 + src/objects.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index c8d0750b..7d3b6b7e 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,7 @@ * animation library: fixed pen state for GLIDE, thanks, Brian! * threads: addressed security issues in the JIT-compiler, thanks, xBZZZZ! * gui: show project name in browser tab, thanks, Peter! +* objects: handle (some cases of) extent-less costumes ### 2022-03-03 * SciSnap2 extension update (FFT), thanks, Eckart! diff --git a/src/objects.js b/src/objects.js index f0ef78d7..b64c4879 100644 --- a/src/objects.js +++ b/src/objects.js @@ -3824,6 +3824,10 @@ SpriteMorph.prototype.wearCostume = function (costume, noShadow) { y = this.yPosition ? this.yPosition() : null, idx = isNil(costume) ? null : this.costumes.asArray().indexOf(costume); + if (costume && (!costume.width() || !costume.height())) { + costume = null; + idx = null; + } this.changed(); this.costume = costume; this.fixLayout();