Skip to content

Commit

Permalink
fix: add bound check
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofnds committed Oct 7, 2024
1 parent d2a02f8 commit b84ffad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion histogram/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func Histogram(t time.Time, activities []habit.Activity, selected int) string {
min, max := 0, 0
for _, a := range activities {
diffInDays := date.DiffInDays(t, a.CreatedAt)
if diffInDays >= 0 {
if diffInDays >= 0 && diffInDays < config.TimeFrameInDays {
hist[diffInDays]++

if hist[diffInDays] > max {
Expand Down

0 comments on commit b84ffad

Please sign in to comment.