From 44cb08297c4fd992f3438b8cac99e1364edd4847 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 27 May 2017 00:53:38 +0200 Subject: Fix some nil errors (#3338) * Fix nil input not handled well in AuthorExtractor concern * Fix hard error in ProcessFeedService when replied-to status has been deleted * Fix nil errors in ProcessInteractionService when favourited status cannot be found --- app/services/process_interaction_service.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/services/process_interaction_service.rb') diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb index e9c01103d..bd9afaf2e 100644 --- a/app/services/process_interaction_service.rb +++ b/app/services/process_interaction_service.rb @@ -108,12 +108,18 @@ class ProcessInteractionService < BaseService def favourite!(xml, from_account) current_status = status(xml) + + return if current_status.nil? + favourite = current_status.favourites.where(account: from_account).first_or_create!(account: from_account) NotifyService.new.call(current_status.account, favourite) end def unfavourite!(xml, from_account) current_status = status(xml) + + return if current_status.nil? + favourite = current_status.favourites.where(account: from_account).first favourite&.destroy end -- cgit