Skip to content

Commit

Permalink
fix(platform): handle cases when metadata is missing
Browse files Browse the repository at this point in the history
the card browse component should be tolerent of cases when the metadata is not properly present, and
not attempt to read information about thumbnails. This was causing the nrowse page to crash if one
of the runs did not have all the needed information
  • Loading branch information
bilalshaikh42 committed Sep 27, 2021
1 parent 930a8de commit f738a74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/platform/src/app/projects/projects.service.ts
Expand Up @@ -62,15 +62,15 @@ export class ProjectsService {
const response = this.http.get<SimulationRunMetadata[]>(url).pipe(
map((projects) => {
return projects.map((project) => {
const thumbnails = project.metadata[0].thumbnails;
const thumbnails = project.metadata[0]?.thumbnails || [];
if (thumbnails.length == 0) {
thumbnails.push(
'./assets/images/default-resource-images/model.svg',
);
}
return {
id: project.id,
title: project.metadata[0].title || project.id,
title: project.metadata[0]?.title || project.id,
thumbnails: thumbnails,
};
});
Expand Down

0 comments on commit f738a74

Please sign in to comment.