From b84ffad3cb2e3b81569be7168af0fba985c51022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Fernandes?= Date: Mon, 7 Oct 2024 19:44:56 -0300 Subject: [PATCH] fix: add bound check --- histogram/histogram.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/histogram/histogram.go b/histogram/histogram.go index cf6c57a..a41d07f 100644 --- a/histogram/histogram.go +++ b/histogram/histogram.go @@ -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 {