Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
fix the "index out of range" error when the length of speed is 0.
Browse files Browse the repository at this point in the history
Signed-off-by: huaxiao <huaxiao@jd.com>
  • Loading branch information
huaxiao committed Nov 27, 2019
1 parent 72b98ba commit bd23388
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/netutils/netutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ func NetLimit() *rate.Rate {
continue
}
speed := compile.FindStringSubmatch(fields[1])
if len(speed) == 0 {
continue
}
if tmpLimit, err := strconv.ParseUint(speed[1], 0, 32); err == nil {
tmpLimit = tmpLimit / 8
if tmpLimit > maxInterfaceLimit {
Expand Down

0 comments on commit bd23388

Please sign in to comment.