From b7d86848c3ba3f1aee3499efcafcd9165c99f77f Mon Sep 17 00:00:00 2001 From: ia3andy Date: Thu, 2 Aug 2018 11:06:51 +0200 Subject: [PATCH] fix: improve catalog consistency check --- src/app/launcher/service/mission-runtime.service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/launcher/service/mission-runtime.service.ts b/src/app/launcher/service/mission-runtime.service.ts index e31c7c5a..ad7df390 100644 --- a/src/app/launcher/service/mission-runtime.service.ts +++ b/src/app/launcher/service/mission-runtime.service.ts @@ -92,7 +92,8 @@ export abstract class MissionRuntimeService { return catalog.boosters.map(b => { const runtime: CatalogRuntime = runtimeById[b.runtime]; const mission: CatalogMission = missionById[b.mission]; - if (!mission || !runtime) { + const version = runtime && runtime.versions.find(v => v.id === b.version); + if (!mission || !runtime || !version) { throw new Error(`Invalid catalog booster: ${JSON.stringify(b)}` ); } return { @@ -102,9 +103,9 @@ export abstract class MissionRuntimeService { mission: mission, runtime: runtime, source: b.source, - version: runtime.versions.find(v => v.id === b.version) + version: version }; - }) + }); } getBoosters(): Observable {