Skip to content

Commit

Permalink
protect strange response
Browse files Browse the repository at this point in the history
  • Loading branch information
bararchy committed Dec 28, 2023
1 parent 3e50870 commit 2769eef
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/sec_tester/scan.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ require "./errors.cr"

module SecTester
class Scan

getter repeater : Repeater
getter scan_duration : Time::Span = Time::Span.new
getter issues
Expand Down Expand Up @@ -128,7 +127,7 @@ module SecTester
response = poll_call
response_json = JSON.parse(response.body.to_s)

@scan_duration = response_json["elapsed"].as_i64.milliseconds
@scan_duration = (response_json["elapsed"].as_i64.milliseconds rescue 0.milliseconds) # From time to times the API will send strange values
@entry_points.set(response_json["entryPoints"].as_i)
@total_params.set(response_json["totalParams"].as_i)
get_issues.each { |issue| @issues << issue unless @issues.includes?(issue) }
Expand Down

0 comments on commit 2769eef

Please sign in to comment.