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,