Skip to content

Commit e67bfb8

Browse files
committed
check: Fix error condition in parsing Flutter version from pubspec
This is intended to check if the pattern failed to match, by checking whether the array `parsed` has zero elements. To do this, it looks at the length of the array... but then it was checking if that length, as a string, is empty. Oops. Instead, check if the length, as a number, is zero.
1 parent c3c9c6b commit e67bfb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ run_flutter_version() {
242242
print "$1 $2" if (
243243
/^ sdk: .*\n flutter: '\''>=(\S+)'\''\s*# ([0-9a-f]{40})$/m)'
244244
) ) || return
245-
if [ -z "${#parsed[@]}" ]; then
245+
if (( ! "${#parsed[@]}" )); then
246246
echo >&2 "error: Flutter version spec not recognized in pubspec.yaml"
247247
return 1
248248
fi

0 commit comments

Comments
 (0)