From 7e7eed290f749bc4aa949978bbb918fa00603d8c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 1 Apr 2022 12:08:53 +0200 Subject: [PATCH] Handle errors when loading group pictures Signed-off-by: Thomas Citharel --- js/src/views/Group/GroupSettings.vue | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/js/src/views/Group/GroupSettings.vue b/js/src/views/Group/GroupSettings.vue index da70ab3ef..da5479e33 100644 --- a/js/src/views/Group/GroupSettings.vue +++ b/js/src/views/Group/GroupSettings.vue @@ -259,17 +259,22 @@ export default class GroupSettings extends mixins(GroupMixin) { @Watch("group") async watchUpdateGroup(oldGroup: IGroup, newGroup: IGroup): Promise { - if ( - oldGroup?.avatar !== undefined && - oldGroup?.avatar !== newGroup?.avatar - ) { - this.avatarFile = await buildFileFromIMedia(this.group.avatar); - } - if ( - oldGroup?.banner !== undefined && - oldGroup?.banner !== newGroup?.banner - ) { - this.bannerFile = await buildFileFromIMedia(this.group.banner); + try { + if ( + oldGroup?.avatar !== undefined && + oldGroup?.avatar !== newGroup?.avatar + ) { + this.avatarFile = await buildFileFromIMedia(this.group.avatar); + } + if ( + oldGroup?.banner !== undefined && + oldGroup?.banner !== newGroup?.banner + ) { + this.bannerFile = await buildFileFromIMedia(this.group.banner); + } + } catch (e) { + // Catch errors while building media + console.error(e); } this.editableGroup = { ...this.group }; }