about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-16 21:23:40 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-16 21:23:40 +0100
commite239fc30503ceaf9ae6ba51233ac3394dcd766f5 (patch)
tree99c9915a33e7a98ab68e200b0e4b9bef7703fe1b /app
parentd0229754442dc824dc38bf99344052b3931998f8 (diff)
Fix error when unfollowing somebody who wasn't followed in the first place
Diffstat (limited to 'app')
-rw-r--r--app/models/account.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index c92bb1574..524d05f86 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -36,7 +36,8 @@ class Account < ActiveRecord::Base
   end
 
   def unfollow!(other_account)
-    self.active_relationships.find_by(target_account: other_account).destroy
+    follow = self.active_relationships.find_by(target_account: other_account)
+    follow.destroy unless follow.nil?
   end
 
   def following?(other_account)