Check if undefined

This commit is contained in:
Lim Chee Aun 2023-03-13 16:22:41 +08:00
parent 348ceedced
commit 3d3d963a42

View file

@ -40,7 +40,7 @@ function Avatar({ url, size, alt = '', ...props }) {
e.target.src = url; e.target.src = url;
}} }}
onLoad={(e) => { onLoad={(e) => {
avatarRef.current.dataset.loaded = true; if (avatarRef.current) avatarRef.current.dataset.loaded = true;
try { try {
// Check if image has alpha channel // Check if image has alpha channel
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');