diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts index c930d610bf827514ffc84cf2e19e58c0e0a0561a..8ae5037c8c3c2107f59cf70ea34ae4ec4851804e 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 }; }