From 7fc03a71e7f084aca751da9d3c249082eaf2a882 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 27 Feb 2025 11:12:04 +0530 Subject: [PATCH] Fix npe --- web/packages/gallery/components/FileInfo.tsx | 2 ++ web/packages/gallery/components/viewer/FileViewer.tsx | 2 +- web/packages/gallery/components/viewer/photoswipe.ts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx index 7be8d32ea3..ec49c17b17 100644 --- a/web/packages/gallery/components/FileInfo.tsx +++ b/web/packages/gallery/components/FileInfo.tsx @@ -7,6 +7,7 @@ Plan of action: and photos/FileInfo to deal with the @/new/photos imports here. */ +import { assertionFailed } from "@/base/assert"; import { LinkButtonUndecorated } from "@/base/components/LinkButton"; import { type ButtonishProps } from "@/base/components/mui"; import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator"; @@ -225,6 +226,7 @@ export const FileInfo: React.FC = ({ onSelectPerson?.(personID); if (!file) { + if (open) assertionFailed(); return <>; } diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx index 4c21d1dab3..0f536fe25a 100644 --- a/web/packages/gallery/components/viewer/FileViewer.tsx +++ b/web/packages/gallery/components/viewer/FileViewer.tsx @@ -189,7 +189,7 @@ const FileViewer: React.FC = ({ void) => () => - cb(currentFileAnnotation()); + cb(currentAnnotatedFile()); // Provide data about slides to PhotoSwipe via callbacks // https://photoswipe.com/data-sources/#dynamically-generated-data