From ae9ff8d962c5a394c3e1886b7e53808a911fc2db Mon Sep 17 00:00:00 2001 From: Glenn Rivkees Date: Sun, 11 Sep 2022 21:28:19 -0400 Subject: [PATCH] fix(api): fix issue where api has a location with no systems listed I think it may be possible for an account to have multiple locations, but have one empty. This probably would happen if someone moved their system between sites, but didn't delete the old site. fix #310 --- src/infinityApi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infinityApi.ts b/src/infinityApi.ts index 4a6a0e0..0efb5ba 100644 --- a/src/infinityApi.ts +++ b/src/infinityApi.ts @@ -255,7 +255,7 @@ export class InfinityEvolutionLocations extends BaseInfinityEvolutionApiModel { await this.fetch(); const systems: string[] = []; for (const location of this.data_object.locations.location) { - for (const system of location.systems[0].system) { + for (const system of location.systems[0].system || []) { const link_parts = system['atom:link'][0]['$']['href'].split('/'); systems.push(link_parts[link_parts.length - 1]); }