From 6a7027462395928a70ba7c0851f280b5163979de Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:22:00 +0100 Subject: [PATCH] fix: handle null enriched comment in comments service - Added a null check for `enrichedComment` to prevent processing invalid data and potential runtime errors. --- backend/src/comments/comments.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/comments/comments.service.ts b/backend/src/comments/comments.service.ts index df7c91e..55d152a 100644 --- a/backend/src/comments/comments.service.ts +++ b/backend/src/comments/comments.service.ts @@ -33,6 +33,7 @@ export class CommentsService { // Récupérer le commentaire avec les infos utilisateur pour le WebSocket const enrichedComment = await this.findOneEnriched(comment.id, userId); + if (!enrichedComment) return null; // Notifier les autres utilisateurs sur ce contenu (room de contenu) this.eventsGateway.sendToContent(contentId, "new_comment", enrichedComment);