Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit f3a2139

Browse files
authored
Merge pull request #48 from DivanteLtd/o2m_improvements
Country mapper fix
2 parents 0bf0f2e + ec766d3 commit f3a2139

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lib/countrymapper.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
let regionId = 0
44
for (let country of countryList) {
55
if (country.id === countryId) {
6-
for (let region of country.available_regions) {
7-
if (region.code === regionCode) {
8-
return { regionId: region.id,
9-
regionCode: region.code }
6+
if (country.available_regions && country.available_regions.length > 0) {
7+
for (let region of country.available_regions) {
8+
if (region.code === regionCode) {
9+
return { regionId: region.id,
10+
regionCode: region.code }
11+
}
1012
}
1113
}
1214
}

0 commit comments

Comments
 (0)