From 6e4d932da53ba236699285ce2bdfcfa07b259fa2 Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 1 May 2022 00:55:26 +0200 Subject: [PATCH] Fix possible crash when a post references an invalid media attachment (#18211) --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/status.rb b/app/models/status.rb index 288d374fd..a4e685ce3 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -254,7 +254,7 @@ class Status < ApplicationRecord media_attachments else map = media_attachments.index_by(&:id) - ordered_media_attachment_ids.map { |media_attachment_id| map[media_attachment_id] } + ordered_media_attachment_ids.filter_map { |media_attachment_id| map[media_attachment_id] } end end