FIX: Handle a deleted topic in thumbnail generation

Follow up to 03818e642a

A topic can be deleted between job enqueue and job execution
This commit is contained in:
Rafael dos Santos Silva 2020-05-11 13:32:37 -03:00
parent 6e3fe1abba
commit 4d137b4f89
No known key found for this signature in database
GPG Key ID: 5E50360227B34938
1 changed files with 2 additions and 2 deletions

View File

@ -10,8 +10,8 @@ module Jobs
raise Discourse::InvalidParameters.new(:topic_id) if topic_id.blank?
topic = Topic.find(topic_id)
topic.generate_thumbnails!(extra_sizes: extra_sizes)
topic = Topic.find_by(id: topic_id)
topic&.generate_thumbnails!(extra_sizes: extra_sizes)
end
end