diff --git a/src/shared/lib/isSampleProfiled.ts b/src/shared/lib/isSampleProfiled.ts index 679b387eabe..5156d6377d5 100644 --- a/src/shared/lib/isSampleProfiled.ts +++ b/src/shared/lib/isSampleProfiled.ts @@ -62,17 +62,22 @@ export function isSampleProfiledInSomeMolecularProfile( export function isSampleProfiledInMultiple( uniqueSampleKey: string, - molecularProfileIds: string[], + molecularProfileIds: string[] | undefined, coverageInformation: CoverageInformation, hugoGeneSymbol?: string ): boolean[] { - // returns boolean[] in same order as molecularProfileIds - const profiledReport = getSampleProfiledReport( - uniqueSampleKey, - coverageInformation, - hugoGeneSymbol - ); - return molecularProfileIds.map( - molecularProfileId => !!profiledReport[molecularProfileId] - ); + // returns empty list if molecularProfileIds is undefined + if (!molecularProfileIds) { + return []; + } else { + // returns boolean[] in same order as molecularProfileIds + const profiledReport = getSampleProfiledReport( + uniqueSampleKey, + coverageInformation, + hugoGeneSymbol + ); + return molecularProfileIds.map( + molecularProfileId => !!profiledReport[molecularProfileId] + ); + } }