Skip to content

Commit

Permalink
Merge pull request #1344 from alphagov/fix-siteimprove-nil-bug
Browse files Browse the repository at this point in the history
Prevent crash if policy not found
  • Loading branch information
KludgeKML authored Jan 23, 2024
2 parents 8f84da2 + 42bd2bd commit d2c5674
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/presenters/siteimprove/policy_issues_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def policy_short_description(policy_name)
end

def policy_description(issue)
note = Siteimprove::FetchPolicies.new.find(issue.id).first.note
policy = Siteimprove::FetchPolicies.new.find(issue.id).first
return "No description for this policy" unless policy

note = policy.note
note.gsub!(/https:\/\/(.+)/, "[https://\\1](https://\\1)")
Govspeak::Document.new(note).to_html
end
Expand Down

0 comments on commit d2c5674

Please sign in to comment.