From ad6340ef047a1c9086b7fcf22cd6ea52dbd84617 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Fri, 19 Feb 2021 10:23:33 +0100 Subject: [PATCH] fix(structureOwner) : fix error when invalid structure --- src/structures/services/structures.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts index c930d610b..8ae5037c8 100644 --- a/src/structures/services/structures.service.ts +++ b/src/structures/services/structures.service.ts @@ -352,6 +352,9 @@ export class StructuresService { emailUser: string ): Promise<{ structure: Structure; owners: string[] }> { const structure = await this.findOne(idStructure); + if (!structure) { + throw new HttpException('Invalid structure id', HttpStatus.BAD_REQUEST); + } const owners = await this.userService.getStructureOwnersMails(idStructure, emailUser); return { structure: structure, owners: owners }; } -- GitLab