From ea2bb53379e726d235e289513505757da232b2ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 1 Jan 2023 23:21:05 +0100 Subject: [PATCH] Fix scheduled statuses page crashing on delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../scheduled-statuses/components/scheduled-status.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/soapbox/features/scheduled-statuses/components/scheduled-status.tsx b/app/soapbox/features/scheduled-statuses/components/scheduled-status.tsx index 1d1a68c947..cca79ffd48 100644 --- a/app/soapbox/features/scheduled-statuses/components/scheduled-status.tsx +++ b/app/soapbox/features/scheduled-statuses/components/scheduled-status.tsx @@ -20,7 +20,12 @@ interface IScheduledStatus { } const ScheduledStatus: React.FC = ({ statusId, ...other }) => { - const status = useAppSelector((state) => buildStatus(state, state.scheduled_statuses.get(statusId)!)) as StatusEntity; + const status = useAppSelector((state) => { + const scheduledStatus = state.scheduled_statuses.get(statusId); + + if (!scheduledStatus) return null; + return buildStatus(state, scheduledStatus); + }) as StatusEntity | null; if (!status) return null;