Skip to content

Commit

Permalink
Fix crash when converting costumes with unexpected clip masks
Browse files Browse the repository at this point in the history
The "Rays" backdrop from the library has an extra path element with
clipMask === true, which causes an error in both convertToBitmap and
convertToVector as paths don't have a size property.

The fix is to only resize the mask created by paint, which will have
guide === true.
  • Loading branch information
GarboMuffin committed Aug 6, 2024
1 parent 5e7bb01 commit 5951da5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/helper/bitmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ const convertToBitmap = function (clearSelectedItems, onUpdateImage, optFontInli
}
for (let i = paper.project.activeLayer.children.length - 1; i >= 0; i--) {
const item = paper.project.activeLayer.children[i];
if (item.clipMask === false) {
if (item.clipMask === false || !item.guide) {
item.remove();
} else {
// Resize mask for bitmap bounds
Expand Down Expand Up @@ -506,7 +506,7 @@ const convertToBitmap = function (clearSelectedItems, onUpdateImage, optFontInli
const convertToVector = function (clearSelectedItems, onUpdateImage) {
clearSelection(clearSelectedItems);
for (const item of paper.project.activeLayer.children) {
if (item.clipMask === true) {
if (item.clipMask === true && item.guide) {
// Resize mask for vector bounds
item.size.height = MAX_WORKSPACE_BOUNDS.height;
item.size.width = MAX_WORKSPACE_BOUNDS.width;
Expand Down

0 comments on commit 5951da5

Please sign in to comment.