Skip to content

Commit

Permalink
fix country codes not being found for EAN13
Browse files Browse the repository at this point in the history
  • Loading branch information
barnhill committed Jan 29, 2021
1 parent 4014ce5 commit b1c7180
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions BarcodeStandard/Symbologies/EAN13.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,28 @@ private string Encode_EAN13()
_countryAssigningManufacturerCode = "N/A";
var twodigitCode = Raw_Data.Substring(0, 2);
var threedigitCode = Raw_Data.Substring(0, 3);
try
{
_countryAssigningManufacturerCode = _countryCodes[threedigitCode].ToString();
}//try
catch

try
{
try
var cc = _countryCodes[threedigitCode];
if (cc == null)
{
_countryAssigningManufacturerCode = _countryCodes[twodigitCode].ToString();
}//try
catch
cc = _countryCodes[twodigitCode].ToString();
if (cc == null)
{
Error("EEAN13-3: Country assigning manufacturer code not found.");
}
else
{
_countryAssigningManufacturerCode = cc.ToString();
}
}
else
{
Error("EEAN13-3: Country assigning manufacturer code not found.");
}//catch
}//catch
_countryAssigningManufacturerCode = cc.ToString();
}

}
finally { _countryCodes.Clear(); }

return result;
Expand Down

0 comments on commit b1c7180

Please sign in to comment.