diff --git a/core.go b/core.go index e14dcc5..397681c 100644 --- a/core.go +++ b/core.go @@ -129,11 +129,12 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { tfdate := t.Format("2006-01-02 15:04:05") - tmp, _ := json.Marshal(ta.TimesOnDay) + var err error + tmp, err := json.Marshal(ta.TimesOnDay) mainKey := fmt.Sprintf("[%s][%s]", tfdate, string(tmp)) value, ok := isInTimeOfDayCacheBool.Load(mainKey) - if ok { + if ok && err == nil { ret := value.(int) if ret == 3 { return true @@ -144,7 +145,6 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { } parseInLocationCache := map[string]time.Time{} - var err error for k := range ta.TimesOnDay { tsp := strings.Split(ta.TimesOnDay[k], "-") if len(tsp) < 2 {