diff --git a/db/db.go b/db/db.go index f2fc21b..65fabef 100644 --- a/db/db.go +++ b/db/db.go @@ -84,7 +84,10 @@ func (db *Db) UpdateMapperLastEvent(userId int, eventId int) (err error) { err = errors.Wrap(err, "couldn't get user events from API") return } - eventId = events[0].ID + + if len(events) > 0 { + eventId = events[0].ID + } } db.gorm.Model(&User{}).Where("id = ?", userId).Update("latest_event_id", eventId)