From c47b76bb74a20e768ab56989141dfe39bc07ea65 Mon Sep 17 00:00:00 2001 From: Vinay Pulim Date: Thu, 21 Jan 2021 10:05:38 -0500 Subject: [PATCH] fix: freezes on iOS due to an uncaught exception --- src/worker/jsqr.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/worker/jsqr.js b/src/worker/jsqr.js index 9f1b549a..598d5f0c 100644 --- a/src/worker/jsqr.js +++ b/src/worker/jsqr.js @@ -18,7 +18,14 @@ export default () => { self.addEventListener("message", function(event) { const imageData = event.data; - const result = jsQR(imageData.data, imageData.width, imageData.height); + let result = null; + try { + result = jsQR(imageData.data, imageData.width, imageData.height); + } catch (error) { + if (!(error instanceof RangeError)) { + throw error; + } + } let content = null; let location = null;