From 80e6156a36816d78f4e6a0ad35b81764d5df486e Mon Sep 17 00:00:00 2001 From: Jean Brito Date: Thu, 24 Aug 2023 15:32:12 -0300 Subject: [PATCH] handle favicon toDataURL exception --- src/servers/preload/favicon.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/servers/preload/favicon.ts b/src/servers/preload/favicon.ts index fea1b109f..a295cf95d 100644 --- a/src/servers/preload/favicon.ts +++ b/src/servers/preload/favicon.ts @@ -24,11 +24,18 @@ const getImageElement = (): HTMLImageElement => { ctx.clearRect(0, 0, FAVICON_SIZE, FAVICON_SIZE); ctx.drawImage(imageElement, 0, 0, FAVICON_SIZE, FAVICON_SIZE); + let favicon; + try { + favicon = canvas.toDataURL(); + } catch (error) { + console.log('Error on Favicon loading:', error); + } + dispatch({ type: WEBVIEW_FAVICON_CHANGED, payload: { url: getServerUrl(), - favicon: canvas.toDataURL(), + favicon, }, }); };