Skip to content

Commit 6db3b29

Browse files
fix: Unhandled cross-origin error while rendering favicon badge (#37515)
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
1 parent cd611e1 commit 6db3b29

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/cuddly-toys-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rocket.chat/favicon": patch
3+
---
4+
5+
Fixes a GUI crash due to an unhandled cross-origin error happening while rendering favicon badge

packages/favicon/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ export const manageFavicon = () => {
9595
}
9696

9797
updateOrCollect = (badge) => {
98-
renderAndUpdate({ badge, canvas, favicons, context, img });
98+
try {
99+
renderAndUpdate({ badge, canvas, favicons, context, img });
100+
} catch (error) {
101+
console.error('Error rendering favicon:', error);
102+
}
99103
};
100104

101105
if (pendingBadge) {
@@ -104,7 +108,9 @@ export const manageFavicon = () => {
104108
}
105109
};
106110

107-
init();
111+
init().catch((error) => {
112+
console.error('Error initializing favicon manager:', error);
113+
});
108114

109115
return (badge: Badge) => {
110116
updateOrCollect(badge);

0 commit comments

Comments
 (0)