Skip to content

Commit 987e677

Browse files
committed
RemoveDuplicates: additional check on length
1 parent 9cd0654 commit 987e677

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nodes.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ func RemoveDuplicates(s []string) []string {
5050
// Walk through the slice 's' and for each value we haven't seen so far, append it to 't'.
5151
for _, v := range s {
5252
if _, seen := m[v]; !seen {
53-
t = append(t, v)
54-
m[v] = true
53+
if len(v) > 0 {
54+
t = append(t, v)
55+
m[v] = true
56+
}
5557
}
5658
}
5759

0 commit comments

Comments
 (0)