Skip to content

Commit

Permalink
Avoid throwing a preventable exception accessing crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bartos committed Jun 15, 2018
1 parent 1879842 commit 452865e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/crypt/decrypter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Decrypter {
if (removePKCS7Padding) {
try {
const browserCrypto = global.crypto;
this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;
if (browserCrypto) {
this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;
}
} catch (e) {}
}
this.disableWebCrypto = !this.subtle;
Expand Down

0 comments on commit 452865e

Please sign in to comment.