Fix crash when unable to resize image
This commit is contained in:
parent
8440a8de42
commit
2f4e671390
@ -39,7 +39,7 @@ export function getImageLightness(image) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef ResizedImage
|
* @typedef ResizedImage
|
||||||
* @property {Blob} blob
|
* @property {Blob|null} blob The blob of the resized image, `null` if the image was unable to be resized to that dimension
|
||||||
* @property {number} width
|
* @property {number} width
|
||||||
* @property {number} height
|
* @property {number} height
|
||||||
*/
|
*/
|
||||||
|
@ -190,6 +190,7 @@ function SelectMapModal({
|
|||||||
file.type,
|
file.type,
|
||||||
resolution.quality
|
resolution.quality
|
||||||
);
|
);
|
||||||
|
if (resized.blob) {
|
||||||
const resizedBuffer = await blobToBuffer(resized.blob);
|
const resizedBuffer = await blobToBuffer(resized.blob);
|
||||||
resolutions[resolution.id] = {
|
resolutions[resolution.id] = {
|
||||||
file: resizedBuffer,
|
file: resizedBuffer,
|
||||||
@ -200,6 +201,7 @@ function SelectMapModal({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Create thumbnail
|
// Create thumbnail
|
||||||
const thumbnail = await createThumbnail(image, file.type);
|
const thumbnail = await createThumbnail(image, file.type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user