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:
parent
aac25b8d51
commit
6f09ab93c2
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue