From 9cbd923c1fef57af6c9f4f0963b3e62f7dfdf777 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 10 Feb 2018 14:04:55 -0500 Subject: [PATCH] Ignoring errors when building blob URL for PNG If it fails, then the link won't be displayed --- src/js/regexper.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/regexper.js b/src/js/regexper.js index 089e749..c6a3440 100644 --- a/src/js/regexper.js +++ b/src/js/regexper.js @@ -181,9 +181,12 @@ export default class Regexper { try { context.drawImage(loader, 0, 0, loader.width, loader.height); canvas.toBlob(blob => { - window.pngBlob = blob; - this.downloadPng.href = URL.createObjectURL(window.pngBlob); - this.links.className = this.links.className.replace(/\bhide-download-png\b/, ''); + try { + window.pngBlob = blob; + this.downloadPng.href = URL.createObjectURL(window.pngBlob); + this.links.className = this.links.className.replace(/\bhide-download-png\b/, ''); + } + catch(e) {} }, 'image/png'); } catch(e) {}