From 00ee3efbff4f597b2996faca822c9ba35a41a813 Mon Sep 17 00:00:00 2001 From: Jaiwanth Date: Mon, 28 Jun 2021 12:39:05 +0530 Subject: [PATCH] Wrap avatar fetch in try catch --- src/utils/exportUtils/HtmlExport.tsx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/utils/exportUtils/HtmlExport.tsx b/src/utils/exportUtils/HtmlExport.tsx index a62f926097..7ece487cf7 100644 --- a/src/utils/exportUtils/HtmlExport.tsx +++ b/src/utils/exportUtils/HtmlExport.tsx @@ -42,10 +42,14 @@ export default class HTMLExporter extends Exporter { const avatarUrl = Avatar.avatarUrlForRoom(this.room, 32, 32, "crop"); const avatarPath = "room.png"; if (avatarUrl) { - const image = await fetch(avatarUrl); - blob = await image.blob(); - this.totalSize += blob.size; - this.addFile(avatarPath, blob); + try { + const image = await fetch(avatarUrl); + blob = await image.blob(); + this.totalSize += blob.size; + this.addFile(avatarPath, blob); + } catch (err) { + console.log("Failed to fetch room's avatar" + err); + } } const avatar = (