mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 19:58:55 +08:00

It seems that due to jobs being asynchronous and wrapping code in a DistributedMutex that by the time we run the `UserAvatar#update_gravatar!` job that the user/user email might be destroyed. This patch checks before a call to `user.email_hash` to make sure the user and primary email exist to prevent the exception. If not present, the job exits as there's nothing to do because we are probably running after the user was destroyed for some reason.