mirror of https://github.com/shunfei/cronsun
model: 修复 nil map
parent
c030862b9c
commit
a615b32ca9
|
@ -43,11 +43,11 @@ func GetGroups(nid string) (groups map[string]*Group, err error) {
|
|||
}
|
||||
|
||||
count := len(resp.Kvs)
|
||||
groups = make(map[string]*Group, count)
|
||||
if count == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
groups = make(map[string]*Group, count)
|
||||
for _, g := range resp.Kvs {
|
||||
group := new(Group)
|
||||
if e := json.Unmarshal(g.Value, group); e != nil {
|
||||
|
|
|
@ -98,11 +98,11 @@ func GetJobs() (jobs map[string]*Job, err error) {
|
|||
}
|
||||
|
||||
count := len(resp.Kvs)
|
||||
jobs = make(map[string]*Job, count)
|
||||
if count == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
jobs = make(map[string]*Job, count)
|
||||
for _, j := range resp.Kvs {
|
||||
job := new(Job)
|
||||
if e := json.Unmarshal(j.Value, job); e != nil {
|
||||
|
|
Loading…
Reference in New Issue