Skip to content

Commit

Permalink
fix error when input value has max length
Browse files Browse the repository at this point in the history
  • Loading branch information
mfdeveloper508 committed Jun 16, 2023
1 parent 2e19f89 commit dd7dc70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions instructingFI.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (ifi *InstructingFI) Parse(record string) error {
ifi.FinancialInstitution.Identifier = value
length += read

if len(ifi.FinancialInstitution.Identifier) >= 34 {
if len(ifi.FinancialInstitution.Identifier) >= 34 && record[length-1:length] != "*" {
length += (strings.Index(record[length:], "*") + 1)
}
value, read, err = ifi.parseVariableStringField(record[length:], 35)
Expand All @@ -61,7 +61,7 @@ func (ifi *InstructingFI) Parse(record string) error {
ifi.FinancialInstitution.Name = value
length += read

if len(ifi.FinancialInstitution.Name) >= 35 {
if len(ifi.FinancialInstitution.Name) >= 35 && record[length-1:length] != "*" {
length += (strings.Index(record[length:], "*") + 1)
}
value, read, err = ifi.parseVariableStringField(record[length:], 35)
Expand All @@ -71,7 +71,7 @@ func (ifi *InstructingFI) Parse(record string) error {
ifi.FinancialInstitution.Address.AddressLineOne = value
length += read

if len(ifi.FinancialInstitution.Address.AddressLineOne) >= 35 {
if len(ifi.FinancialInstitution.Address.AddressLineOne) >= 35 && record[length-1:length] != "*" {
length += (strings.Index(record[length:], "*") + 1)
}
value, read, err = ifi.parseVariableStringField(record[length:], 35)
Expand All @@ -81,7 +81,7 @@ func (ifi *InstructingFI) Parse(record string) error {
ifi.FinancialInstitution.Address.AddressLineTwo = value
length += read

if len(ifi.FinancialInstitution.Address.AddressLineTwo) >= 35 {
if len(ifi.FinancialInstitution.Address.AddressLineTwo) >= 35 && record[length-1:length] != "*" {
length += (strings.Index(record[length:], "*") + 1)
}
value, read, err = ifi.parseVariableStringField(record[length:], 35)
Expand Down

0 comments on commit dd7dc70

Please sign in to comment.