From 494df940364b98730ae06ed08e94e5742b40a4d2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 Feb 2021 09:28:50 +0100 Subject: Fix abuse crash on deleted video --- server/models/abuse/abuse.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/models/abuse/abuse.ts b/server/models/abuse/abuse.ts index de249d211..262f364f1 100644 --- a/server/models/abuse/abuse.ts +++ b/server/models/abuse/abuse.ts @@ -434,10 +434,10 @@ export class AbuseModel extends Model { } buildBaseVideoCommentAbuse (this: MAbuseUserFormattable) { - if (!this.VideoCommentAbuse) return null + // Associated video comment could have been destroyed if the video has been deleted + if (!this.VideoCommentAbuse || !this.VideoCommentAbuse.VideoComment) return null - const abuseModel = this.VideoCommentAbuse - const entity = abuseModel.VideoComment + const entity = this.VideoCommentAbuse.VideoComment return { id: entity.id, -- cgit v1.2.3