]> cat aescling's git repositories - mastodon.git/commitdiff
Fix a couple unhandled exceptions
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 23 Jan 2017 12:56:57 +0000 (13:56 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 23 Jan 2017 12:56:57 +0000 (13:56 +0100)
app/controllers/stream_entries_controller.rb
app/services/notify_service.rb

index 3f60bb0c4c005669112da2563bfbef14ab55fa15..5701b2efae12eec74945e7b73b8624574db136b2 100644 (file)
@@ -46,7 +46,7 @@ class StreamEntriesController < ApplicationController
     @stream_entry = @account.stream_entries.find(params[:id])
     @type         = @stream_entry.activity_type.downcase
 
-    raise ActiveRecord::RecordNotFound if @stream_entry.hidden? && (@stream_entry.activity_type != 'Status' || (@stream_entry.activity_type == 'Status' && !@stream_entry.activity.permitted?(current_account)))
+    raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil? || (@stream_entry.hidden? && (@stream_entry.activity_type != 'Status' || (@stream_entry.activity_type == 'Status' && !@stream_entry.activity.permitted?(current_account))))
   end
 
   def check_account_suspension
index 2eb0f417d50b3513d1d974466a5b725a93ce9f43..1ec36637c06a107b975568a8575d1fffb81f2390 100644 (file)
@@ -6,7 +6,7 @@ class NotifyService < BaseService
     @activity     = activity
     @notification = Notification.new(account: @recipient, activity: @activity)
 
-    return if blocked?
+    return if blocked? || recipient.user.nil?
 
     create_notification
     send_email if email_enabled?