From a87c43e999a05f9a6e7d358e2e204a71b959d6db Mon Sep 17 00:00:00 2001 From: zmagod Date: Thu, 4 Jan 2018 14:49:52 +0100 Subject: [PATCH] nil image guard [fixes SCI-1907] --- lib/tasks/tiny_mce_asset.rake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/tasks/tiny_mce_asset.rake b/lib/tasks/tiny_mce_asset.rake index a668cee5b..20c01033a 100644 --- a/lib/tasks/tiny_mce_asset.rake +++ b/lib/tasks/tiny_mce_asset.rake @@ -21,6 +21,9 @@ namespace :tiny_mce_asset do step.description.gsub!(regex) do |el| match = el.match(regex) old_img = TinyMceAsset.find_by_id(match[1]) + # skip other processing and deletes tiny_mce tag + # if image is not in database + next unless old_img new_img = TinyMceAsset.create(image: old_img.image, team: team, reference: step) @@ -47,6 +50,9 @@ namespace :tiny_mce_asset do result_text.text.gsub!(regex) do |el| match = el.match(regex) old_img = TinyMceAsset.find_by_id(match[1]) + # skip other processing and deletes tiny_mce tag + # if image is not in database + next unless old_img new_img = TinyMceAsset.create(image: old_img.image, team: team, reference: result_text)