Skip to content
Snippets Groups Projects
Commit 450c6ec6 authored by xaralis's avatar xaralis
Browse files

fix: possible Home crash when program isn't loaded yet

parent d5aae28b
No related branches found
No related tags found
No related merge requests found
......@@ -94,11 +94,24 @@ const Home = () => {
? programEntries[scheduleIds[0]]
: null;
if (!programEntry && new Date() < firstProgramEntry.expectedStartAt) {
return <NotYetStarted startAt={firstProgramEntry.expectedStartAt} />;
if (
!programEntry &&
(!firstProgramEntry || new Date() < firstProgramEntry.expectedStartAt)
) {
return (
<NotYetStarted
startAt={
firstProgramEntry ? firstProgramEntry.expectedStartAt : undefined
}
/>
);
}
if (!programEntry && new Date() > lastProgramEntry.expectedStartAt) {
if (
!programEntry &&
lastProgramEntry &&
new Date() > lastProgramEntry.expectedStartAt
) {
return <AlreadyFinished />;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment