Skip to content

Commit

Permalink
Fixes #35172 - Do not crash if report template missing
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Jul 13, 2022
1 parent 2d45583 commit da4b4d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/remote_execution_helper.rb
Expand Up @@ -246,7 +246,7 @@ def load_template_from_task(template_invocation, target)
def job_report_template
template = ReportTemplate.where(name: Setting['remote_execution_job_invocation_report_template']).first

template if template.template_inputs.where(name: 'job_id').exists?
template if template && template.template_inputs.where(name: 'job_id').exists?
end

def job_report_template_parameters(job_invocation, template)
Expand Down
4 changes: 4 additions & 0 deletions test/helpers/remote_execution_helper_test.rb
Expand Up @@ -37,5 +37,9 @@ class RemoteExecutionHelperTest < ActionView::TestCase

assert_equal template.id, found_template.id
end

it 'should not crash if the template cannot be found' do
assert_nil job_report_template
end
end
end

0 comments on commit da4b4d1

Please sign in to comment.