From a31975d3699adfd6c317a72a6962c5f434a316d2 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 288d374fd3..a4e685ce3e 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