From c10a818d6512f4675c646384fb65146cde2d03e4 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sun, 14 Feb 2021 08:50:27 +1100 Subject: [PATCH] Fix crash with resized images over the canvas size limitation --- src/modals/SelectMapModal.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modals/SelectMapModal.js b/src/modals/SelectMapModal.js index 2236bc5..c31465c 100644 --- a/src/modals/SelectMapModal.js +++ b/src/modals/SelectMapModal.js @@ -183,14 +183,16 @@ function SelectMapModal({ file.type, resolution.quality ); - const resizedBuffer = await blobToBuffer(resized.blob); - resolutions[resolution.id] = { - file: resizedBuffer, - width: resized.width, - height: resized.height, - type: "file", - id: resolution.id, - }; + if (resized.blob) { + const resizedBuffer = await blobToBuffer(resized.blob); + resolutions[resolution.id] = { + file: resizedBuffer, + width: resized.width, + height: resized.height, + type: "file", + id: resolution.id, + }; + } } }