Skip to content

Commit

Permalink
fix: return empty name if no category found
Browse files Browse the repository at this point in the history
  • Loading branch information
theredrad committed Sep 27, 2021
1 parent 1aadc00 commit b0225ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,19 @@ func (m *Manager) Total() int {
}

func (m *Manager) randomCategory() string {
if len(m.mc) == 0 {
return ""
}

rand.Seed(time.Now().UnixNano())
return m.mc[rand.Intn(len(m.mc))]
}

func (m *Manager) randomEntity(c string) string {
if len(m.mc) == 0 {
return ""
}

rand.Seed(time.Now().UnixNano())
if _, ok := m.ds[c]; !ok {
return ""
Expand Down

0 comments on commit b0225ff

Please sign in to comment.