]> cat aescling's git repositories - mastodon.git/commitdiff
Fix nil error in migration (#7680)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 31 May 2018 00:30:37 +0000 (02:30 +0200)
committerGitHub <noreply@github.com>
Thu, 31 May 2018 00:30:37 +0000 (02:30 +0200)
Under rare circumstances the user record could have already been deleted before...

db/migrate/20180528141303_fix_accounts_unique_index.rb

index 92e490f9e88143d5a762e346a660f8ba8426efa2..aadb5b7db9fba30a5645231d46c097db10688b5a 100644 (file)
@@ -49,7 +49,7 @@ class FixAccountsUniqueIndex < ActiveRecord::Migration[5.2]
         # are always either going to be local or not local, so only
         # one check is needed. Since we cannot support two users with
         # the same username locally, one has to go. ðŸ˜¢
-        other_account.user.destroy
+        other_account.user&.destroy
       end
 
       other_account.destroy