From efe721e9dc95bb48bf534f481e1f7599bbefb422 Mon Sep 17 00:00:00 2001 From: hidden4003 Date: Sat, 4 May 2024 15:21:17 +0300 Subject: [PATCH] Minor fixes (#893) * fix Ts().state is null * fix Cannot read properties of undefined (reading 'ID') --- .../utilities/ReleaseManagementUtilityTabs/MultiplesUtil.tsx | 1 + src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/utilities/ReleaseManagementUtilityTabs/MultiplesUtil.tsx b/src/pages/utilities/ReleaseManagementUtilityTabs/MultiplesUtil.tsx index 06377fe63..267b50f5c 100644 --- a/src/pages/utilities/ReleaseManagementUtilityTabs/MultiplesUtil.tsx +++ b/src/pages/utilities/ReleaseManagementUtilityTabs/MultiplesUtil.tsx @@ -45,6 +45,7 @@ const MultiplesUtil = () => { if (!selectedEpisode) return null; const file = selectedEpisode.Files!.find(item => item.ID === toNumber(id))!; + if (!file) return null; if (option === 'delete') return deleteFile({ fileId: file.ID, removeFolder: false }); if (option === 'variation' && !file.IsVariation) return markVariation({ fileId: file.ID, variation: true }); if (option === 'keep' && file.IsVariation) return markVariation({ fileId: file.ID, variation: false }); diff --git a/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx b/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx index 23ceed618..cfc568896 100644 --- a/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx +++ b/src/pages/utilities/UnrecognizedUtilityTabs/LinkFilesTab.tsx @@ -190,7 +190,7 @@ const AnimeSelectPanel = ( function LinkFilesTab() { const navigate = useNavigate(); - const { selectedRows } = useLocation().state as { selectedRows: FileType[] }; + const { selectedRows } = (useLocation().state ?? []) as { selectedRows: FileType[] }; const [{ createdNewSeries, isLinking, isLinkingRunning }, setLoading] = useState({ isLinking: false, isLinkingRunning: false,