pxt-arcade 1.12.16 → 1.12.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2554,11 +2554,13 @@ var pxsim;
2554
2554
  }
2555
2555
  multiplayer.postImage = postImage;
2556
2556
  function postIcon(iconType, slot, im) {
2557
- if (im._width * im._height > 64 * 64) {
2557
+ if (im && (im._width * im._height > 64 * 64)) {
2558
2558
  // setting 64x64 as max size for icon for now
2559
2559
  return;
2560
2560
  }
2561
- const asBuf = pxsim.image.toBuffer(im);
2561
+ // treat empty icon as undefined
2562
+ const asBuf = (im && im.data.some(pixel => pixel != 0))
2563
+ ? pxsim.image.toBuffer(im) : undefined;
2562
2564
  const sb = pxsim.board();
2563
2565
  const screenState = sb && sb.screenState;
2564
2566
  pxsim.getMultiplayerState().send({
package/built/sim.js CHANGED
@@ -2868,11 +2868,13 @@ var pxsim;
2868
2868
  }
2869
2869
  multiplayer.postImage = postImage;
2870
2870
  function postIcon(iconType, slot, im) {
2871
- if (im._width * im._height > 64 * 64) {
2871
+ if (im && (im._width * im._height > 64 * 64)) {
2872
2872
  // setting 64x64 as max size for icon for now
2873
2873
  return;
2874
2874
  }
2875
- const asBuf = pxsim.image.toBuffer(im);
2875
+ // treat empty icon as undefined
2876
+ const asBuf = (im && im.data.some(pixel => pixel != 0))
2877
+ ? pxsim.image.toBuffer(im) : undefined;
2876
2878
  const sb = pxsim.board();
2877
2879
  const screenState = sb && sb.screenState;
2878
2880
  pxsim.getMultiplayerState().send({