Skip to content

Commit

Permalink
Merge pull request #80 from projectdiscovery/bugfix-nil-err
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 authored Aug 21, 2023
2 parents fce27c4 + a494c91 commit 4e461b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,24 +936,24 @@ func init() {
return nil, errors.NewWithErr(err).Msgf("invalid start position")
}
if start > len(argStr) {
return nil, errors.NewWithErr(err).Msgf("start position bigger than slice length")
return nil, errors.New("start position bigger than slice length")
}
if len(args) == 2 {
return argStr[start:], nil
}

end, err := strconv.Atoi(toString(args[2]))
if err != nil {
return nil, errors.NewWithErr(err).Msgf("invalid end position")
return nil, errors.New("invalid end position")
}
if end < 0 {
return nil, errors.NewWithErr(err).Msgf("negative end position")
return nil, errors.New("negative end position")
}
if end < start {
return nil, errors.NewWithErr(err).Msgf("end position before start")
return nil, errors.New("end position before start")
}
if end > len(argStr) {
return nil, errors.NewWithErr(err).Msgf("end position bigger than slice length start")
return nil, errors.New("end position bigger than slice length start")
}
return argStr[start:end], nil
}))
Expand Down

0 comments on commit 4e461b8

Please sign in to comment.