Prevent errors when no sets are recorded today

This commit is contained in:
Brandon Presley 2022-09-03 14:50:54 +12:00
parent 7a7c8b20b9
commit 67a30a2360
1 changed files with 1 additions and 1 deletions

View File

@ -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;