From 89b8e98cd262632a2c969622d57da3ac74cc2d0e Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 17 Mar 2025 15:43:21 +0530 Subject: [PATCH] Fix --- web/packages/gallery/components/viewer/photoswipe.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts index 1f5ad6b7fc..00b2c19405 100644 --- a/web/packages/gallery/components/viewer/photoswipe.ts +++ b/web/packages/gallery/components/viewer/photoswipe.ts @@ -639,10 +639,11 @@ export class FileViewerPhotoSwipe { button.disabled = pendingFavoriteUpdates.has(af.file.id); // Update the fill visibility based on the favorite status. - showIf( - document.getElementById("pswp__icn-favorite-fill")!, - !!delegate.isFavorite(af), - ); + const fill = document.getElementById("pswp__icn-favorite-fill"); + if (fill) { + // Need a null check since we might've been closed meanwhile. + showIf(fill, !!delegate.isFavorite(af)); + } }; const handleToggleFavorite = () => void toggleFavorite();