Skip to content

Commit c47b76b

Browse files
vpulimgruhn
authored andcommitted
fix: freezes on iOS due to an uncaught exception
1 parent e64d034 commit c47b76b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/worker/jsqr.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ export default () => {
1818

1919
self.addEventListener("message", function(event) {
2020
const imageData = event.data;
21-
const result = jsQR(imageData.data, imageData.width, imageData.height);
21+
let result = null;
22+
try {
23+
result = jsQR(imageData.data, imageData.width, imageData.height);
24+
} catch (error) {
25+
if (!(error instanceof RangeError)) {
26+
throw error;
27+
}
28+
}
2229

2330
let content = null;
2431
let location = null;

0 commit comments

Comments
 (0)