Skip to content

Commit

Permalink
closes #185
Browse files Browse the repository at this point in the history
  • Loading branch information
mdzio committed Aug 11, 2024
1 parent 79e7e7d commit 1a4ef35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virtdev/mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ func (e *extractorTmpl) Extract(payload []byte) (float64, error) {
if err != nil {
return 0.0, fmt.Errorf("Template execution failed for payload '%s': %v", string(payload), err)
}
fval, err := strconv.ParseFloat(sb.String(), 64)
// erase white space
sval := strings.TrimSpace(sb.String())
fval, err := strconv.ParseFloat(sval, 64)
if err != nil {
return 0.0, fmt.Errorf("Template returned invalid number literal: %s", sb.String())
}
Expand Down

0 comments on commit 1a4ef35

Please sign in to comment.