Skip to content

Commit

Permalink
Update senml.go - fixed runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak authored Nov 1, 2023
1 parent 1914a44 commit 91de157
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions senml.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func Validate(p Pack) error {
return ErrEmptyName
}

r.Name := replaceInvalidCharacters(name)
r.Name = replaceInvalidCharacters(name)

var valCnt int
if r.Value != nil {
Expand Down Expand Up @@ -256,7 +256,7 @@ func validateName(name string) error {
if (l == '-') || (l == ':') || (l == '.') || (l == '/') || (l == '_') {
return ErrBadChar
}
for pos, l := range name {
for _, l := range name {
if (l < 'a' || l > 'z') && (l < 'A' || l > 'Z') && (l < '0' || l > '9') && (l != '-') && (l != ':') && (l != '.') && (l != '/') && (l != '_') {
return ErrBadChar
}
Expand Down

0 comments on commit 91de157

Please sign in to comment.