From af5467a0d7ef61b1ff866a35751bf93a9982a0d8 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 27 Mar 2020 22:28:39 +0100 Subject: [PATCH] Fix crash when posting with a CW but no text nor media --- app/services/post_status_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 39b834604a..250d0e8edd 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -50,11 +50,11 @@ class PostStatusService < BaseService def preprocess_attributes! if @text.blank? && @options[:spoiler_text].present? @text = '.' - if @media.find(&:video?) || @media.find(&:gifv?) + if @media&.find(&:video?) || @media&.find(&:gifv?) @text = '📹' - elsif @media.find(&:audio?) + elsif @media&.find(&:audio?) @text = '🎵' - elsif @media.find(&:image?) + elsif @media&.find(&:image?) @text = '🖼' end end