Skip to content

Commit

Permalink
fix: nil pointer in urltest (MetaCubeX#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzdnzd authored Jun 5, 2023
1 parent fdaa6a2 commit e717486
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (p *Proxy) URLTest(ctx context.Context, url string, expectedStatus utils.In
}
}

if !expectedStatus.Check(uint16(resp.StatusCode)) {
if expectedStatus != nil && !expectedStatus.Check(uint16(resp.StatusCode)) {
// maybe another value should be returned for differentiation
err = errors.New("response status is inconsistent with the expected status")
}
Expand Down
2 changes: 1 addition & 1 deletion common/utils/ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewIntRangesFromList[T constraints.Integer](list []string) (IntRanges[T], e
}

func (ranges IntRanges[T]) Check(status T) bool {
if ranges == nil || len(ranges) == 0 {
if len(ranges) == 0 {
return true
}

Expand Down

0 comments on commit e717486

Please sign in to comment.