nil image guard [fixes SCI-1907]

This commit is contained in:
zmagod 2018-01-04 14:49:52 +01:00
parent 7e2392f620
commit a87c43e999

View file

@ -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)