Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
Check stats.length > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
rubentd committed Mar 28, 2020
1 parent 1866762 commit 29ae919
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/util/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const toDateStat = (report: CovidReport, reportIndex: number): DateStat => ({

const getCurrentDateStat = (stats: DateStat[]): DateStat => ({
x: new Date(),
y: stats[stats.length - 1].y
y: stats.length > 0 ? stats[stats.length - 1].y : 0
});

export function calculateTotalReportsStats(
Expand Down

0 comments on commit 29ae919

Please sign in to comment.