Address PR feedback

pull/10048/head
Edd Robinson 2018-07-09 11:13:08 +01:00
parent ad388a8fd8
commit 537da76efd
1 changed files with 5 additions and 2 deletions

View File

@ -1573,11 +1573,14 @@ func parseTags(buf []byte, dst Tags) Tags {
}
n := bytes.Count(buf, []byte(","))
if len(dst) < n {
if cap(dst) < n {
dst = make(Tags, n)
} else {
dst = dst[:n]
}
if dst == nil { // Ensure existing behaviour.
// Ensure existing behaviour when point has no tags and nil slice passed in.
if dst == nil {
dst = Tags{}
}