diff --git a/scripts/tables/countryTable.ts b/scripts/tables/countryTable.ts
index 5e167b7fd..06a72490e 100644
--- a/scripts/tables/countryTable.ts
+++ b/scripts/tables/countryTable.ts
@@ -36,15 +36,17 @@ export class CountryTable implements Table {
const subdivision = subdivisions.first(
(subdivision: Subdivision) => subdivision.code === code
)
- const country = countries.first(
- (country: Country) => country.code === subdivision.country
- )
- data.add([
- `${country.name}/${subdivision.name}`,
- ` ${subdivision.name}`,
- logItem.count,
- `https://iptv-org.github.io/iptv/${logItem.filepath}
`
- ])
+ if (subdivision) {
+ const country = countries.first(
+ (country: Country) => country.code === subdivision.country
+ )
+ data.add([
+ `${country.name}/${subdivision.name}`,
+ ` ${subdivision.name}`,
+ logItem.count,
+ `https://iptv-org.github.io/iptv/${logItem.filepath}
`
+ ])
+ }
} else if (countryCode === 'INT') {
data.add([
'ZZ',