lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb in contrast-agent-7.4.1 vs lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb in contrast-agent-7.5.0

- old
+ new

@@ -15,17 +15,17 @@ module BuildPreflight class << self # @param finding [Contrast::Agent::Reporting::Finding] # @return [Contrast::Agent::Reporting::Preflight, nil] def generate finding - return unless finding + return unless finding&.cs__is_a?(Contrast::Agent::Reporting::Finding) new_preflight = Contrast::Agent::Reporting::Preflight.new new_preflight_message = Contrast::Agent::Reporting::PreflightMessage.new - finding.routes.each do |route| - new_preflight_message.routes << route + routes = finding.routes + unless Contrast::Utils::DuckUtils.empty_duck?(routes) + routes.each { |route| new_preflight_message.routes << route } end - new_preflight_message.hash_code = finding.hash_code new_preflight_message.data = "#{ finding.rule_id },#{ finding.hash_code }" new_preflight.messages << new_preflight_message return new_preflight unless Contrast::Utils::DuckUtils.empty_duck?(new_preflight.messages) nil