diff --git a/app/models/user.rb b/app/models/user.rb index f0275931780..d2d35bbc16f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1240,7 +1240,7 @@ class User < ActiveRecord::Base end def email - primary_email.email + primary_email&.email end def email=(new_email) diff --git a/app/services/user_merger.rb b/app/services/user_merger.rb index d45da9dbeeb..989c67e796b 100644 --- a/app/services/user_merger.rb +++ b/app/services/user_merger.rb @@ -369,7 +369,7 @@ class UserMerger def log_merge logger = StaffActionLogger.new(@acting_user || Discourse.system_user) - logger.log_user_merge(@target_user, @source_user.username, @source_primary_email) + logger.log_user_merge(@target_user, @source_user.username, @source_primary_email || "") end def update_user_id(table_name, opts = {})