Fix possible crash when a post references an invalid media attachment (#18211)

This commit is contained in:
Claire 2022-05-01 00:55:26 +02:00 committed by GitHub
parent 5a48bf1085
commit 6e4d932da5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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