Skip to content

Commit

Permalink
Prevent undefined array reference error
Browse files Browse the repository at this point in the history
Following error encountered when trying to print a latency summary, in a rare situation where all of the results were strikes:

    Can't use an undefined value as an ARRAY reference at sqm-autorate.pl line 1253.

Prevent this error by checking that the valid ping array references are defined before trying to dereference them.
  • Loading branch information
tievolu authored Sep 12, 2022
1 parent 2b59beb commit 05b0508
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sqm-autorate.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,11 @@ sub print_latency_results_summary {
return;
}

if (!defined($valid_pings_ul_ref) || !defined($valid_pings_dl_ref)) {
&output(0, "LATENCY SUMMARY: No valid results!");
return;
}

my @valid_pings_ul = @{$valid_pings_ul_ref};
my @valid_pings_dl = @{$valid_pings_dl_ref};

Expand Down

0 comments on commit 05b0508

Please sign in to comment.