Skip to content

Commit

Permalink
RemoveDuplicates: additional check on length
Browse files Browse the repository at this point in the history
  • Loading branch information
mtds committed Apr 16, 2021
1 parent 9cd0654 commit 987e677
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ func RemoveDuplicates(s []string) []string {
// Walk through the slice 's' and for each value we haven't seen so far, append it to 't'.
for _, v := range s {
if _, seen := m[v]; !seen {
t = append(t, v)
m[v] = true
if len(v) > 0 {
t = append(t, v)
m[v] = true
}
}
}

Expand Down

0 comments on commit 987e677

Please sign in to comment.