Skip to content

Commit

Permalink
handle favicon toDataURL exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanfbrito committed Aug 24, 2023
1 parent 36402b4 commit 80e6156
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/servers/preload/favicon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
};
Expand Down

0 comments on commit 80e6156

Please sign in to comment.