1
0
Fork 0
mirror of https://github.com/Luzifer/worktime.git synced 2024-12-22 22:11:16 +00:00

Ensure times slice is available

This commit is contained in:
Knut Ahlers 2016-09-24 15:35:37 +02:00
parent aac25b8d51
commit 6f09ab93c2
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -117,7 +117,7 @@ func LoadDay(db *couch.Client, date time.Time, mayCreate bool) (*Day, error) {
doc := &Day{} doc := &Day{}
if err := db.Get(id, doc); err != nil { if err := db.Get(id, doc); err != nil {
if strings.Contains(err.Error(), "not_found") && mayCreate { if strings.Contains(err.Error(), "not_found") && mayCreate {
doc = &Day{DayID: id} doc = &Day{DayID: id, Times: []*Time{}}
} else { } else {
return nil, err return nil, err
} }