Skip to content

Commit

Permalink
fix: decoder developer field string handler (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
muktihari authored May 20, 2024
1 parent bdbca32 commit e2f3f5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ func (d *Decoder) decodeDeveloperFields(mesgDef *proto.MessageDefinition, mesg *

// NOTE: It seems there is no standard on utilizing Array field to handle []string in developer fields.
// Discussion: https://forums.garmin.com/developer/fit-sdk/f/discussion/355554/how-to-determine-developer-field-s-value-type-is-a-string-or-string
const overrideStringArray = true
overrideStringArray := developerField.BaseType == basetype.String
val, err := d.readValue(developerField.Size, mesgDef.Architecture, baseType, profileType, isArray, overrideStringArray)
if err != nil {
return err
Expand Down Expand Up @@ -967,7 +967,7 @@ func (d *Decoder) readValue(size byte, arch byte, baseType basetype.BaseType, pr
if err != nil {
return val, err
}
if overrideStringArray {
if overrideStringArray && baseType == basetype.String {
isArray = strlen(b) > 1
}
return proto.UnmarshalValue(b, arch, baseType, profileType, isArray)
Expand Down

0 comments on commit e2f3f5c

Please sign in to comment.