Fix null type issue

This commit is contained in:
Michael
2021-12-04 15:37:12 +01:00
parent 35efae778a
commit 1b635c7551

View File

@@ -33,8 +33,10 @@ const Avatar = ({ url, size, onUpload }: AvatarProps): JSX.Element => {
if (error) {
throw error;
}
const url = URL.createObjectURL(data);
setAvatarUrl(url);
if (data) {
const url = URL.createObjectURL(data);
setAvatarUrl(url);
}
} catch (error: unknown) {
if (error instanceof Error) {
console.log('Error downloading image: ', error.message);