Skip to content

Commit

Permalink
metrics: clear before writing string values
Browse files Browse the repository at this point in the history
  • Loading branch information
suyash committed Jul 18, 2016
1 parent 60e0f28 commit 8b57432
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions metrics.go
Expand Up @@ -143,8 +143,10 @@ func (m MetricType) WriteVal(val interface{}, b bytebuffer.Buffer) error {
case float64:
return b.WriteFloat64(val.(float64))
case *PCPString:
b.WriteString(val.(*PCPString).val)
return b.WriteVal(byte(0))
pos := b.Pos()
b.Write(make([]byte, 256))
b.SetPos(pos)
return b.WriteString(val.(*PCPString).val)
}

return errors.New("Invalid Type")
Expand Down

0 comments on commit 8b57432

Please sign in to comment.