Skip to content

Commit

Permalink
feat: add length checks for css.List()
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jun 4, 2024
1 parent 91c2b1b commit 35a6f0a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/dependency/parser/dart/pub/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func firstVersionOfConstrain(constraint string) (string, error) {
// Dart uses only `>=` and `^` operators:
// cf. https://dart.dev/tools/pub/dependencies#traditional-syntax
constraints := css.List()
if len(constraints) == 0 || len(constraints[0]) == 0 {
return "", nil
}
// We only need to get the first version from the range
if constraints[0][0].Operator() != ">=" && constraints[0][0].Operator() != "^" {
return "", nil
Expand Down

0 comments on commit 35a6f0a

Please sign in to comment.