Check for crop arguments before applying it

This commit is contained in:
SillyLossy
2023-05-16 10:37:52 +03:00
parent 2b54d21617
commit 1bfb5637b0

View File

@@ -860,7 +860,7 @@ async function charaWrite(img_url, data, target_img, response = undefined, mes =
let rawImg = await jimp.read(img_url); let rawImg = await jimp.read(img_url);
// Apply crop if defined // Apply crop if defined
if (typeof crop == 'object') { if (typeof crop == 'object' && [crop.x, crop.y, crop.width, crop.height].every(x => typeof x === 'number')) {
rawImg = rawImg.crop(crop.x, crop.y, crop.width, crop.height); rawImg = rawImg.crop(crop.x, crop.y, crop.width, crop.height);
} }