From ce74fb91b3b1beb73b9efa964975df695c651944 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Mon, 6 Feb 2023 18:50:33 +0530 Subject: [PATCH] add error handling to PhotoFrame url prefill --- src/components/PhotoFrame.tsx | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/components/PhotoFrame.tsx b/src/components/PhotoFrame.tsx index 28584b9a8..34aaf47f3 100644 --- a/src/components/PhotoFrame.tsx +++ b/src/components/PhotoFrame.tsx @@ -203,17 +203,21 @@ const PhotoFrame = ({ h: window.innerHeight, title: item.pubMagicMetadata?.data.caption, }; - if (galleryContext.thumbs.has(item.id)) { - updateFileMsrcProps( - filteredItem, - galleryContext.thumbs.get(item.id) - ); - } - if (galleryContext.files.has(item.id)) { - updateFileSrcProps( - filteredItem, - galleryContext.files.get(item.id) - ); + try { + if (galleryContext.thumbs.has(item.id)) { + updateFileMsrcProps( + filteredItem, + galleryContext.thumbs.get(item.id) + ); + } + if (galleryContext.files.has(item.id)) { + updateFileSrcProps( + filteredItem, + galleryContext.files.get(item.id) + ); + } + } catch (e) { + logError(e, 'PhotoFrame url prefill failed'); } return filteredItem; });