From d9204b7dc0792122668804e347167229f146bbab Mon Sep 17 00:00:00 2001 From: thislight Date: Sat, 17 Aug 2024 15:33:34 +0800 Subject: [PATCH] Home: fix the crash if no profile exists --- src/timelines/Home.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/timelines/Home.tsx b/src/timelines/Home.tsx index 5483771..2bd5e34 100644 --- a/src/timelines/Home.tsx +++ b/src/timelines/Home.tsx @@ -198,8 +198,16 @@ const Home: ParentComponent = (props) => { const settings$ = useStore($settings); const [profiles] = useSignedInProfiles(); - const profile = () => profiles()[0].inf; - const client = () => profiles()[0].client; + const profile = () => { + const all = profiles(); + if (all.length > 0) { + return all[0].inf; + } + }; + const client = () => { + const all = profiles() + return all?.[0]?.client + }; const navigate = useNavigate(); const [heroSrc, setHeroSrc] = createSignal({});