FIX: Handle a deleted topic in thumbnail generation

FIX: Handle a deleted topic in thumbnail generation

Follow up to 03818e642a1ae871bffdc0c39c10f05f0b8b0398

A topic can be deleted between job enqueue and job execution

diff --git a/app/jobs/regular/generate_topic_thumbnails.rb b/app/jobs/regular/generate_topic_thumbnails.rb
index a014526..e670e0f 100644
--- a/app/jobs/regular/generate_topic_thumbnails.rb
+++ b/app/jobs/regular/generate_topic_thumbnails.rb
@@ -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

GitHub sha: 4d137b4f