From 67a30a2360236b00d434b75b3616952b0b25b2f1 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sat, 3 Sep 2022 14:50:54 +1200 Subject: [PATCH] Prevent errors when no sets are recorded today --- SetList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SetList.tsx b/SetList.tsx index b080157..f0cd36b 100644 --- a/SetList.tsx +++ b/SetList.tsx @@ -117,7 +117,7 @@ export default function SetList() { const todaysWorkouts = todaysPlan[0].workouts.split(','); let workout = todaysWorkouts[0]; console.log(`${SetList.name}.predict:`, {todaysSets, todaysWorkouts}); - if (todaysWorkouts.includes(todaysSets[0].name) && todaysSets.length > 0) { + if (todaysWorkouts.includes(todaysSets[0]?.name) && todaysSets.length > 0) { const count = todaysSets.filter( s => s.name === todaysSets[0].name, ).length;