about summary refs log tree commit diff
path: root/app/services/post_status_service.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-03-27 22:28:39 +0100
committerThibaut Girka <thib@sitedethib.com>2020-03-27 22:28:39 +0100
commitd98fabf2ee44c2c25775066abda46552ab05993e (patch)
tree413de2a72a6f3a126e19e12178524ca33c27e436 /app/services/post_status_service.rb
parentfaa56643b8d226e1bc19a87c2e169870f7648aee (diff)
Fix crash when posting with a CW but no text nor media
Diffstat (limited to 'app/services/post_status_service.rb')
-rw-r--r--app/services/post_status_service.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 39b834604..250d0e8ed 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