Skip to content

Commit

Permalink
fix: freezes on iOS due to an uncaught exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vpulim authored and gruhn committed Mar 4, 2021
1 parent e64d034 commit c47b76b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/worker/jsqr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c47b76b

Please sign in to comment.