]> cat aescling's git repositories - mastodon.git/commitdiff
Fix possible crash when a post references an invalid media attachment (#18211)
authorClaire <claire.github-309c@sitedethib.com>
Sat, 30 Apr 2022 22:55:26 +0000 (00:55 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Thu, 5 May 2022 17:49:13 +0000 (13:49 -0400)
app/models/status.rb

index cc7ee568f9e886ef2f69b6c613047b8740407a75..75b464a70843b568826ad3c32d08147a3e7c638b 100644 (file)
@@ -259,7 +259,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